JNI-performance - Is it really that fast?

Paul Hohensee Paul.Hohensee at Sun.COM
Fri Mar 21 20:43:37 UTC 2008


Yes, it really is that fast.

Sounds like biased locking is disabled, which it shouldn't be.
We'd have to have the benchmark source to puzzle out why.

Paul

Clemens Eisserer wrote:
> 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
>   



More information about the discuss mailing list