Hi, this topic may belong to mauve but I am not sure whether all the VM implementors are on that list.
Recently there was a discussion[0] on the sdljava list about the efficieny of direct NIO buffers and Java arrays. It took place because OpenGL functions like glVertex3fv(float[]) in C where mapped to Java methods like this glVertex3f(FloatBuffer). If you don't know OpenGL: the functions expect that the array/buffer contains only 3 values. A user of the sdljava library (which is currently tied together with gljava) found out that it is better to use Java arrays as arguments here. He expected his application to do frequent allocations of the buffer/arrays and this would kill performance in case of the direct NIO buffers. To underly this he wrote a small benchmark (which we are allowed to license under GNU GPL[1]) I remember that once upon a time Michael said we should test for performance regressions in mauve and I think the attached benchmark could be used for that. Ideas, thoughts anything? Anyway, if have not read the sdljava discussion thread. Here are the benchmark results for two of our free VMs in comparison with JDK1.5.0 on my machine (Athlon XP 2200+ w/ 512 MB Ram): [EMAIL PROTECTED] ~/tmp/test/bench/buffer-vs-arrays $ LD_LIBRARY_PATH=. gij Benchmark running Test Benchmark$TestArrayReallocate for 1000000 times result: 2705 running Test Benchmark$TestArrayAllocateOnce for 1000000 times result: 2242 running Test Benchmark$TestByteBufferReallocate for 1000000 times result: 4329 running Test Benchmark$TestByteBufferAllocateOnce for 1000000 times result: 1047 (This is GCJ 4.0 somewhat.) [EMAIL PROTECTED] ~/tmp/test/bench/buffer-vs-arrays $ LD_LIBRARY_PATH=. jamvm Benchmark running Test Benchmark$TestArrayReallocate for 1000000 times result: 1825 running Test Benchmark$TestArrayAllocateOnce for 1000000 times result: 1443 running Test Benchmark$TestByteBufferReallocate for 1000000 times result: 7916 running Test Benchmark$TestByteBufferAllocateOnce for 1000000 times result: 278 [EMAIL PROTECTED] ~/tmp/test/bench/buffer-vs-arrays $ (Both are interpreted only. JamVM has a handcrafted JNI implementation that really outperforms the JDK) As a comparison my JDK 1.5.0 results: LD_LIBRARY_PATH=. /opt/sun-jdk-1.5.0/bin/java Benchmark running Test Benchmark$TestArrayReallocate for 1000000 times result: 484 running Test Benchmark$TestArrayAllocateOnce for 1000000 times result: 386 running Test Benchmark$TestByteBufferReallocate for 1000000 times result: 15891 running Test Benchmark$TestByteBufferAllocateOnce for 1000000 times result: 287 Well done hackers! cu Robert [0] - http://sourceforge.net/mailarchive/forum.php?thread_id=8148756&forum_id=43388 [1] - http://sourceforge.net/mailarchive/message.php?msg_id=12939689
nio-benchmark.tar.gz
Description: GNU Zip compressed data
_______________________________________________ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath