4 ms·
I don't know, but it's much slower than I expected. It's the latest Java installable by apt on Debian (all these tests are run in Debian running under VMWare).
by smanek 17y ago
I don't know, but it's much slower than I expected.
It's the latest Java installable by apt on Debian (all these tests are run in Debian running under VMWare).
$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (build 1.6.0_0-b11)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)
- jbooth 17y agoDohhhhh don't use OpenJDK :) Get the sun version, it's probably faster. Although it may not be much faster, found this unfixed bug report: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005861 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005861
- jbooth 17y agoIn more depth : the sun JDK probably does a lot better job of JIT compilation, it's the difference between running interpreted bytecode and compiled native code. On the Hadoop project, checksumming was a major CPU constraint, because you have to assume every file everywhere is possibly on faulty hardware, and checksum everything. They found that it was actually faster to implement CRC32 in pure Java and let the JIT compilation do it's magic than it was to make native calls to zlibc. But that may not apply to floating point if the Java implementation is bad enough.
- igouy 17y agoJava sin and cos might not be using the machine hardware. Plain vanilla use of Math.sin and Math.cos = 9.15s Constrain to the range +45 to -45 degrees = 4.88s As demonstrated 20 months ago http://shootout.alioth.debian.org/gp4/program.php?test=partialsums&lang=java&id=4 http://shootout.alioth.debian.org/gp4/program.php?test=parti...