[concurrency-interest] ConcurrentLinkedQueue in Java 5 vs. 6
martinrb at google.com
Sat Apr 7 15:15:33 EDT 2012
On Sat, Apr 7, 2012 at 10:45, Ilya Mirsky <ilya.mirsky at gmail.com> wrote:
> Running some benchmarks on a multicore machine (Ultra SPARC T2),
> I noticed a significant improvement in performance
> of ConcurrentLinkedQueue in Java 6 (1.6.0_23) over Java 5 (1.5.0_14).
> The improvement in high contention scenarios is in a factor of up to 5
> That kind of improvement is a bit of a surprise, but one we're happy to
> I'm curious about the reason for this improvement, as the basic algorithm
> is the same (MS queue)...
> Examining both of the source files, I noticed that in Java 6 version
> there's a use in lazySet in some places,
> and direct usage of Unsafe class, instead of AtomicReferenceFieldUpdater
> in java 5.
> But could this explain the significant improvement, or are there other key
> Good question. There were lots of small improvements. Perhaps it's due
to updateHead trying CAS only once. Or perhaps breaking long chains of
dead nodes, to be nice to the GC, and to avoid useless iteration.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest