[concurrency-interest] private field

Doug Lea dl@cs.oswego.edu
Thu, 14 Oct 2004 19:19:27 -0400

> But, is-it possible to improve performance one step farther?  I am 
> worried about memory allocation and garbage collection; maybe we can 
> improve performance by reusing LinkedBlockingQueue.Node?

I don't think this is a performance concern.  In micro-benchmarks,
LinkedBlockingQueue usually has better concurrent scalability than
ArrayBlockQueue, which doesn't do any dynamic allocation.
It's hard to predict how well either of these will work in
any given application, which is why we supply both. But I don't
think that in-between solutions work out too well, although please
feel free to prove to me otherwise :-)

(Digressing: In lock-free data structures like
jsr166x.ConcurrentSkipListMap, dynamic allocation is sometimes used to
avoid needing locks, which wins big even considering GC overhead. See
the internal documentation in
for some discussion of this. The moral here is that it is often better
to exploit, rather than evade GC in performance-sensitive code.)