Melvin Koh's Weblog

I'm just a contractor

« Solaris 10 Applicati... | Main | Clustered JVM -... »

20070222 Thursday February 22, 2007


Java is not slow?

There is an article that debunks the rumor that Java is slow. This article suggests that the "myth" of C/C++ applications, as native binary, will always be faster than Java, is not true. To a certain extend I agree with the author - poorly written C/C++ app can perform much worse than a Java app. Now, Java is my favorite programming language, but as someone working in HPC, all I can say is that I'm not at all convinced.

 

Posted by melvin ( Feb 22 2007, 04:53:26 PM SGT ) Permalink Comments [4]

Trackback URL: http://blogs.sun.com/melvin/entry/java_is_not_slow
Comments:

Depends what you're doing...

Right now I am trying to tune a bit of performance-critical financial/numeric C++ code for a client. The (GCC3.2.x) static compiler has done a good job, but cannot take care of about ~25% non-numeric overhead testing and retesting the same conditions, using virtual calls though there is no actual run-time polymorphism, etc, that HotSpot would be able to detect and optimise away at run-time.

Rgds

Damon

Posted by Damon Hart-Davis on February 22, 2007 at 07:44 PM SGT #

That java could outperform poorly written code has been true for a long time. That it can outperform well written code is a more recent development. What you are missing and what the previous commenter alluded too, is that the the JIT compiler is able to do run time optimizations by default that are available to the C/C++ compiler only through great difficulty via execution profiling.

Posted by Brian Utterback on February 22, 2007 at 10:58 PM SGT #

I don't know about run time optimizations, but using compile time optimizations, with a good compiler (e.g. our Sun Studio), we can get a decent well-tuned C/C++/Fortran applications with some ease, and even tuned it to the specific architecture. Also, a application performance depends on many factors, including disk I/O, network communications, threading etc. I'm just not sure how JIT compares to native performance in all these department.

Posted by 203.125.39.114 on February 23, 2007 at 10:05 AM SGT #

Java will always be slow. Its reference semantics for classes make it a memory hog. Try to implement an efficient array of 2d points to see what I mean. Java is also very unexpressive: Try to make a type that is 32 bit wide on a 32 bit machine and 64 bit wide on a 64 bit machine (because you often want to count objects in RAM). You can't.

Posted by 217.86.125.164 on April 01, 2007 at 12:41 AM SGT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

This is a personal weblog, I do not speak for my employer.