ReentrantLock performance regression between JDK5 and 6/7?

Clemens Eisserer linuxhippy at
Thu Aug 11 07:47:29 PDT 2011


Recently I played a bit with wait/notify as well as await/signal, to see
which solution handles the case of few calls to wait/await but a lot
notify/signal calls better.
ReentrantLock/Condition came out far ahead and in general both results where
quite good :)

I noticed however a performance degradation between jre5u22 and
The following micro-benchmark executes in 41ms with jre5u22 but takes 53ms
on jdk6/7 on my Core2Duo/Conroe:

 ReentrantLock lock = new ReentrantLock();
 while (true) {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
        System.out.println("Lock bench: " + (System.currentTimeMillis() -

Is this a tradeoff of some kind, or a regression?

Thanks, Clemens
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-runtime-dev mailing list