Link Details

Link 13561 thumbnail
User 202026 avatar

By shemnon
via idiom.com
Published: Feb 13 2007 / 21:24

Hard academic analysis of Java vs. C++, providing actual benchmarks. What's the answer? Depends on what you are doing, sometimes a HotSpot Java compiler is faster than heavily optimized C++, sometimes it's not. Usually, it's close enough it doesn't matter really.
  • 20
  • 0
  • 4129
  • 1105

Comments

Add your comment
User 182143 avatar

mezmo replied ago:

0 votes Vote down Vote up Reply

Why?
I know we all feel the need to beat the drum, but this report was issued in 2003, updated in 2004 and addresses JRE1.4.
I don't think anyone disputes that given some time java code will rip along with the best of just about anything. That isn't the issue. The issue is that when I start up an applet, or Eclipse, or whatever, I feel as though I've time to go get a cup of coffee whilst waiting for it to get to the point where I can do useful work. I know that JRE1.5 & 1.6 has supposedly made this all better, but I haven't noticed it yet, and I use java almost exclusively every day.
JMHO (for those that can't remember that far back it means Just My Honest Opinion, some say it should be Humble...but I'm not ;)

User 202026 avatar

shemnon replied ago:

1 votes Vote down Vote up Reply

You'd be surprised how deeply ingrained the Java is Slow FUD is ingrained in some shops. Even if the data is 3-4 years old showing parity 3-4 years ago will help combat the FUD.

User 200606 avatar

cossins replied ago:

-2 votes Vote down Vote up Reply

Well, the thing is that Java *IS* slow in many cases. Especially startup time is unacceptable. Memory usage is also a very serious issue.

It appears these things have improved dramatically in 1.6, but I'm not too optimistic about it just yet. In my opinion, it's too late. Object-Oriented Programming is important, and Java does that very well, but it does just about every other development model extremely poorly (static members are just... awkward), and it seems people are moving towards more mixed modes (with Ruby, Python, C++ and D).

Java isn't dead, but it is dying. And it should be, it has been superseded by superior languages/frameworks.

- Simon

User 209613 avatar

MattGiuca replied ago:

0 votes Vote down Vote up Reply

A very good article. Even if a lot of it is just "in theory Java should be faster" - it's good to know we'll get there - maybe not even with Java - but that it's possible for high-level memory-safe languages to be fast.

User 202757 avatar

vvs replied ago:

1 votes Vote down Vote up Reply

C'mon, guys, this isn't even funny. The article is FOUR years long! There were two MAJOR updates to Java VM since then. The latest Java VM is much faster, more optimized, provides some ways to combat footprint and startup issues (shared class data), etc, etc.

User 209827 avatar

evarlast replied ago:

-1 votes Vote down Vote up Reply

Now do the same comparison in 8MB of memory. 4MB. 2MB. 1MB. 512K

These are still VERY real memory environments.

User 205047 avatar

Lowell Heddings replied ago:

0 votes Vote down Vote up Reply

"faster than heavily optimized C++"

Java has come a long way, and is very fast, especially on the server side. It might sometimes be faster than normal C++ code. But there is no way it's faster than "heavily optimized" C++ code.

User 207273 avatar

abhibeckert replied ago:

0 votes Vote down Vote up Reply

Which fanboy voted the parent down? I've seen heavily optimized C++ do stuff in 0.002 seconds that took at least 10 seconds in every other language we tried.

A Java program will never be able to compete with that kind of performance.

User 206924 avatar

dmh2000 replied ago:

0 votes Vote down Vote up Reply
User 210221 avatar

jdh30 replied ago:

0 votes Vote down Vote up Reply

One of the main conclusions that can be drawn from my ray tracer language comparison:

http://www.ffconsultancy.com/languages/ray_tracer/index.html

is that Java is one of the slowest compiled languages out there, as slow as Lisp.

Moreover, I just finished repeating that benchmark on my new dual core AMD64 and Java is doing relatively worse than it was before. C++ and OCaml are now leading the pack.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.