Sun Java is faster than C/C++

This is quite cool. Andy Johnson, a colleague of mine on the Java performance team, did a few performance tests comparing Java to native C. SciMark2 was used for the performance comparision. The system under test was a 2Ghz Pentium white box running Windows 2000 and using the Microsoft Visual C/C++ 6. The C code was compiled with full optimization. The server compiler was used for both J2SE 5.0_07 and Java SE 6. Scimark2 is a set of simple numerical kernels and its performance is directly related to the performance and quality of the generated code. The tests are single threaded and have little to no garbage collection overhead. In short, a great set of applications to compare statically compiled C code and dynamically compiled Java. The chart below is quite revealing. Both the charts are normalized to J2SE 5.0_07. Native C is only 3% faster than 5.0_07 and Java SE 6 pulls ahead of native C by 2%. The following chart breaks the comparison down further. Remember SciMark2 is a composite benchmark and the overall score is a simple mean of each subtest mflops score. With that, Java is ahead in some cases, and behind in others. Actually Java is ahead in all cases except Sparse Matmult. Looks like we have something to look at for additional optimization.
Comments:

The comparison is unfair. You have to compare the latest version of Microsoft Visual Studio (2005) against the latest version of Java (6.0). Visual Studio 6.0 was released almost 10 years ago.

Posted by Edson Watanabe on June 09, 2006 at 06:02 AM EDT #

I have to agree - please re-run those test with a decent compiler... like Studio 11!

Posted by Michael van der Westhuizen on June 09, 2006 at 06:36 AM EDT #

This leads me to think that Java is definitely catching up...but Java still has to catch and surpass the newest C/C++ compilers. Still it is nothing to laugh at Mustang being faster than Visual Studio 6. And it is only in beta2 stage as of the moment. Wonder how fast the finished product would be.

Posted by Surya on June 09, 2006 at 08:03 AM EDT #

Ack - the results are great, but I'm a bit less enthusiastic about the title. Sounds too much like a blanket statement.

My guess (long ago) was that Java performance with JIT would equal or beat C performance on heavy floating point (and GUI code - another topic) before anything else.

I would guess the SciMark2 code is not typical of either Java or C applications. :)

Posted by Preston L. Bannister on June 09, 2006 at 08:16 AM EDT #

Ummm, have a look here: http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=java&lang2=gpp

Posted by guest on June 09, 2006 at 08:54 AM EDT #

Thanks for the link to the debian benchmark site. Very cool.

Posted by dagastine on June 09, 2006 at 09:44 AM EDT #

Running the benchmark on my machine using Java 1.6.0-beta and VS 2005 express gives 388.67 and 631.12 mflops respectively, which is a much larger difference than you observed with the older C compiler. Your closer figure reflects my experience with Java 1.4 and VC++ 6. I started thinking a bit more about this, but got too long for a comment so put it here

Posted by Pete Kirkham on June 11, 2006 at 06:21 AM EDT #

Post a Comment:
Comments are closed for this entry.
About

dagastine

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today