logo       

Re: ArrayBlockingQueue and addAll(): msg#00037

java.jsr.166-concurrency

Subject: Re: ArrayBlockingQueue and addAll()

Kasper Nielsen wrote:
> Hi,
>
> Any reason for not letting ArrayBlockingQueue.addAll() use a more
> efficient implementation then the one inherited from AbstractCollection?
>

It is mainly because there's not a huge possibility for improvement.
Suppose for example a queue with capacity 100 gets calls from two different
threads to addAll with 200 elements each. At best you could put in the
first 100 for the first one, and let the others contend one-by-one as
consumers remove elements. This and other small improvements aren't
usually enough faster that letting all of them contend one-by-one
to deserve explicit coding. Although people who frequently hit cases
where it would be enough faster to bother, might feel differently.
So it is a good suggestion for a potential small performance improvement,
that we ought to take up someday. Thanks!

-Doug


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise