[concurrency-interest] PooledLinkedBlockingQueue

Doug Lea dl@cs.oswego.edu
Thu, 4 Nov 2004 20:17:10 -0500


> MyPooledLinkedList.  This class is exacly like LinkedList, so its
> not thread-safe.  The test show a huge performance difference
> between the two lists ...  Could you explain this difference please?

In a purely sequential environment, you probably want a bulk-allocated
array-based queue -- probably it would perorm a bit faster than your
pooled version. We never got to this in JSR166 -- we planned for the
Deque interface, and to also have an array-based sequential version,
but didn't have enough time to complete this for Tiger. We have the
Deque interface up in jsr166x pacakage, and will add ArrayDeque once
Josh Bloch and I finish arguing over it :-) Deque and its
implementations should make it into next major release.  (BTW, expect
a few minor API changes to Deque interface.)

As a coarse rule of thumb, array-based structures are better in
sequential applications, and dynamic node-based better in concurrent
applications.

-Doug