Computing.Net > Forums > Programming > C or Java or PERL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C or Java or PERL

Reply to Message Icon

Name: surfistadesampa
Date: February 9, 2005 at 11:23:04 Pacific
OS: Linux
CPU/Ram: Pentium III
Comment:

Hi all !!!

What's programming language is more fast, C, Java or Perl ?

Thanks !!



Sponsored Link
Ads by Google

Response Number 1
Name: BlueRaja
Date: February 9, 2005 at 14:43:49 Pacific
Reply:

C

BlueRaja.admin@gmail.com


0

Response Number 2
Name: Rolos
Date: February 9, 2005 at 14:50:44 Pacific
Reply:

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


0

Response Number 3
Name: BlueRaja
Date: February 9, 2005 at 17:13:10 Pacific
Reply:

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


0

Response Number 4
Name: Mechanix2Go
Date: February 9, 2005 at 22:16:15 Pacific
Reply:

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


0

Response Number 5
Name: Wolfbone
Date: February 9, 2005 at 23:39:34 Pacific
Reply:

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.



0

Related Posts

See More



Response Number 6
Name: gimmpy225
Date: February 10, 2005 at 14:49:42 Pacific
Reply:

C, because once you learn C you can learn C++ and java since they are both derived from C.

GIMPS


0

Response Number 7
Name: BlueRaja
Date: February 10, 2005 at 15:45:09 Pacific
Reply:

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


0

Response Number 8
Name: BlueRaja
Date: February 10, 2005 at 15:52:11 Pacific
Reply:

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


0

Response Number 9
Name: Rolos
Date: February 10, 2005 at 19:13:44 Pacific
Reply:

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


0

Response Number 10
Name: Rolos
Date: February 10, 2005 at 19:17:51 Pacific
Reply:

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


0

Response Number 11
Name: BlueRaja
Date: February 10, 2005 at 21:32:49 Pacific
Reply:

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... ;P

BlueRaja.admin@gmail.com


0

Response Number 12
Name: Wolfbone
Date: February 11, 2005 at 03:54:29 Pacific
Reply:

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.


0

Response Number 13
Name: surfistadesampa
Date: February 11, 2005 at 05:22:53 Pacific
Reply:

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 !!


0

Response Number 14
Name: Wolfbone
Date: February 11, 2005 at 08:31:41 Pacific
Reply:

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.


0

Response Number 15
Name: Hemali
Date: February 16, 2005 at 20:28:41 Pacific
Reply:

can any one explain how to implement trie in c?
regards
Hem


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C or Java or PERL

C++ or Perl help www.computing.net/answers/programming/c-or-perl-help/6287.html

c or basic www.computing.net/answers/programming/c-or-basic/10496.html

ZIP libraries in C or Visual C www.computing.net/answers/programming/zip-libraries-in-c-or-visual-c/1068.html