JNI-performance - Is it really that fast?
linuxhippy at gmail.com
Fri Mar 21 12:25:10 UTC 2008
I did some benchmarks to evaluate JNI-call-per-operation vs.
Command-batch-buffer performance for a design where low per-primitive
overhead is important.
I was totally impressed about the low overhead JNI has in modern
SUN-JVMs. On my Core2Duo-2ghz it took only 35cycles to call a native
method with 4 jint parameters and count an int-loop-counter up, 58mio
times per second. Making the methods synchronized however time went up
to 100 cycles per call.
Has JNI really become that fast, or is it likely that I have hit a
I thought JDK6 has BiasedLocking (I only tested single threaded), why
is synchronization so expensive in this case? (my call-graph is
benchmark-loop -> (synchronized) accessor-method -> native-method).
Thanks, lg Clemens
More information about the discuss