JNI-performance - Is it really that fast?

Christian Wimmer wimmer at ssw.jku.at
Fri Mar 21 22:33:51 UTC 2008


Hi

> 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).

If you have a short-running benchmark, the following could be the reason:
Biased locking is enabled 4 seconds after startup. Addtionally, objects that
are allocated in the first 4 seconds stay unbiasable for their entire
lifetime.
The flag -XX:BiasedLockingStartupDelay=0 can be used to enable biased
locking immediately at startup.

Christian





More information about the discuss mailing list