Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
The fastest of the three to my knowledge is C. Java is said to be more reliable, as the Java designers chose reliability over execution speed. I'm not sure if this applies to every aspect of the Java vs. C scenario, but I know this applies to particular implementations of data structures. And if I'm not mistaken, someone correct me if I'm wrong, but I believe that Java is a hybrid language? Perl is a scripting language, and I don't really know how you'd compare a scripting language to mainstream programming languages such as Java and C.
- Rolos

Perl is a scripting language; it's compiled on the fly.
Java is compiled into bytecode; this is faster than compiling in a scripting language, but still relatively slow when compared to precompiled code (although the advantage of bytecode is that it's system-independent...keep that in mind).
C is precompiled, and is by far the fastest of the three; and given its ability to edit data at a lower level (pointers, inline assembly, etc.), it's faster than most of its competitors (VB, et al).BlueRaja.admin@gmail.com

BlueRaja,
Would you say a little nore about byte code?
Is that what makes it platform independent?
Or is it the java installed on the platform which "expects" the byte code?
TIA
M2

Are you the same Claudio who was earlier trying to get awk to find the differences between 3 files within a certain time?
Assuming you program optimally, then unsurprisingly machine code beats C beats anything else. Comparing other languages is trickier though: It would depend on the nature of the task, the machine, the quality of the compiler/interpreter, the quality of implementation of the language and your knowledge of them and a lot of other factors.
Java for example may be at an immediate disadvantage in any comparison since the VM and language base you use is usually proprietary and will not have been optimised for your particular machine.
That aside, there are many surprises when these kinds of question are tested empirically: Java should be comparable to C++ even for simple tasks (at least I would've thought so) and faster than scripting languages, but apparently not. Likewise - intuitively, C++ really ought to be faster than Lisp, but it is not.

Mech: Basically, bytecode looks like machine code, but isn't designed for any one specific platform (processor).
A VM (or "Virtual Machine") written on that platform takes the bytecode and translates it into its platform's machine code.
You cannot run the bytecode without first having the VM installed (which is why you need a Java VM to run Java...)
If you still have questions, google the term.Gimps: He's asking which one turns out the fastest running code, not which language would be best to learn.
BlueRaja.admin@gmail.com

Wolfbone: If you take a look at your article, it says that the fastest C program was faster than the fastest LISP program; however, on average, the LISP programs ran faster. This does not mean that the language itself is faster; simply that there are more poor C programmers than there are poor LISP programmers ;)
BlueRaja.admin@gmail.com

Indeed you cannot run your Java app unless you have the JVM installed on your machine. Though I am not sure if it is safe to say that VMs in general converts the byte code into machine code. Rather it's converted into simple machine code via a JIT compiler (not being an a$$ or disrespecting you Raja by any means). This simple machine code is the bytecode. But it can be confused easily with machine code, which bytecode is not.
BTW, I like this discussion, good topic.
- Rolos

My mistake. The Java is converted into bytecode then interpreted by some means such as a JIT compiler to be executed by the VM. I think that's right...correct me if I'm wrong.
- Rolos

Uhh...isn't that what I said, only (unnecessarily) more technical?
Just for clarification,
JIT = Just in Time
It's a feature of most VM's to compile the bytecode on the fly (or rather, only when certain elements are needed) rather than precompile the entire program before running it.
Just one of the many reasons to admire Bail... ;PBlueRaja.admin@gmail.com

BlueRaja: Yes I know - that's why I made sure to say "tested empirically". Beyond a quite low level of complexity of program it is probably worthless to talk about "optimal programming".
On the quality of programmers: there is a lot to be said for the idea that some languages are better than others at making good programmers but popularity can heavily skew the statistics too of course - as you said.

uhuhhuhuhu sorry, i was travelling ...
Thanks for help ...
Wolfbone: That my script is perfect, and thanks so much for your help ... it has 10.000 lines ..... each day has new subscribers in database and a time this script will be so slow, and i need translate this script to C or Java ...
Thanks !!

Hi Claudio - I happened to find your problem quite interesting at the time and did a comparison between Awk, C and Lisp to see for myself what would happen. The test was rather artificial (10000 words/lines from a dictionary) but you are welcome to any code you might find useful. The C program was rather sensitive to compiler flags.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |