ReentrantLock performance regression between JDK5 and 6/7?

Vitaly Davidovich vitalyd at gmail.com
Thu Aug 11 08:26:23 PDT 2011


Which OS are you using?

Also, you should use System.nanoTime() for this type of timing as it gives
you a more precise timer.
On Aug 11, 2011 10:49 AM, "Clemens Eisserer" <linuxhippy at gmail.com> wrote:
> Hi,
>
> 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
> openjdk6/jdk7b147.
> 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++) {
> lock.lock();
> lock.unlock();
> }
> System.out.println("Lock bench: " + (System.currentTimeMillis() -
> start));
> }
>
> Is this a tradeoff of some kind, or a regression?
>
> Thanks, Clemens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20110811/1ed81cff/attachment.html 


More information about the hotspot-runtime-dev mailing list