JNI-performance - Is it really that fast?

yueyu lin popeyelin at gmail.com
Fri Mar 21 20:55:19 UTC 2008

You can look at the BerkeleyDB's JNI wrapper edition(not Java Edition), it's
almost as fast as its c edition from my experience. I use both of them in
On Fri, Mar 21, 2008 at 5:25 AM, Clemens Eisserer <linuxhippy at gmail.com>

> Hello,
> 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
> microbenchmark trap?
> 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

Yueyu Lin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/discuss/attachments/20080321/32f28ffa/attachment.html>

More information about the discuss mailing list