I've been testingJava versus C after seeing sites that mention Java is closs to the performance of C for numerical computing. In order to use a standard code that is available in C and java, I've tried scimark2 (http://math.nist.gov/scimark2/). However, the results are not as simple as the 'java is just as fast as C' articles suggest.
All java results are with the compiled scimark java benchmark. The C results are from using gcc. All results are the composite score.
On a PA-Risc system running HPUX11i and java1.4/gcc2.95, scimark2 produces: C: 282 Java: 262 and scimark2 -large gives: C: 70 Java: 55 this comparison agrees with expectation and also shows an enormous penalty for the -large problem which may exceed the cache of many processors (the PA-risc 8700 with 2.25MB L1 cache, no L2) I tried java -server but the differences to the above numbers were trivial. With java1.5 on the pa-risc based system scimark2 produced 150MFlops
On a 2.8GHz Pentium4 running Win2000 and java1.5/gcc2.95, scimark2 gives: C: 300 Java: 180 and scimark2 -large gives: C: 200 Java: 160
So, I have two questions: is there a performance difference between java1.4 and java1.5 that would explain the huge slowdown on the pa-risc system? Secondly, while the pa-risc system results for java1.4 and C compare well, the C versus java on the Wintel system doesn't compare well at all. For that matter, the java1.5 on the pa-risc system is very poor compared to C. Are there extra performance issues or settings with java1.5 to alter this?
Thanks for the suggestion. I was able to do more testing and found the java results more inline with expectations.
On the Wintel P4/2.8GHz with Java1.5 scimark2 produced: C ~300 Java ~180 Java -server ~430 Thus, the default -client on Windows (PC not server) hampered the performance and using the -server option now produced significantly better results than C. This is very good. Further testing with the -large version of scimark2 produced similar results for C, java and java -server.
However, all testing with java1.5 on the PA-risc system showed it to be slower than the java1.4 version. I used a serious of optimization options from the Sun performance document and they only added a few percent extra. I'm confused by the pa-risc results, but I know that the pa-risc is now end of life. Therefore, spending too much more time on the pa-risc might not be worth while.
Still, if anyone knows how to increase the performance of java on the pa-risc, please, let me know - a pa-risc system runs our core java application.
Point of correction, you cant compare Java to C. Java is a language and an environment. C is only a language. If you are comparing performance then you are comparing So-and-So's JVM performance, vs. So-and-So's C compiler code optimization performance.
This is not Java vs. C. The JVM you are running may well have been written in C.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop