For a long time, C/C++ with GCC (the GNU compiler) was the absolute winner. Some other, similar languages, eg. the D language from digitalmars challenged their first place, but could never displace them. (I was a great fan of the D language for some time...) - So finally who would believe that one day Java will take over and - at least in some benchmarks - beat C and C++?
This 'one day' has come. Recently I checked the results for the n-body benchmark, and here is a screenshot of the result (click to see it in full size):

Note that while Fortran is at the first place, it is only 1 millisecond faster than Java, and the Java running time also includes a much longer startup time and the JIT compilation. C is one whole second slower than Java.
I know this is not a definitive verdict over C/C++, probably a few weeks later I'll see completely different results, - still it is very impressive. It also confirms my own results with SciMark 2.0 on my dual-core laptop (Windows), giving consistently better scores for Java over C++.

2 comments:
Thank you for saying how interesting you find the benchmarks game website!
C is one whole second slower than Java ... I know this is not a definitive verdict over C/C++
Remember - that C program is one whole second slower than that Java program - maybe that isn't the best way to write the program in C?
(The old Pentium 4 measurements consistently put a naive Oberon-2 program at the top - and OO2C does source-to-C-source translation before compiling with GCC.)
And if you look at the x64 measurements you'll see something different.
Java running time also includes a much longer startup time and the JIT compilation
Which helps to explain the time taken but does not make the programs any quicker :-)
You've probably seen the old JVM profiling and dynamic compilation comparison.
... C is one whole second slower than Java
And if the Java program was one whole second slower than a C++ program?
Post a Comment