[concurrency-interest] RFR [8011215] optimization of CopyOnWriteArrayList.addIfAbsent()

Martin Buchholz martinrb at google.com
Tue Apr 2 16:55:21 EDT 2013


Thanks for this change.  There is a tradeoff here.  If the element is never
present, then the older code might be a little faster, because we can avoid
re-traversing the array.  Otherwise, the new code is better.

I prefer it your way (I hate unneeded allocation), but the code was
intentionally written the other way.  Let's hear from Doug...

Martin


On Tue, Apr 2, 2013 at 1:38 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com>wrote:

>
>   Please review my proposal for the CopyOnWriteArrayList.addIfAbsent()
>> method optimization.
>>
>> http://washi.ru.oracle.com/~igerasim/webrevs/8011215/webrev/index.html
>
>
>  This URL is not readable by external reviewers.
>
>
> The webrev has been copied here:
> http://cr.openjdk.java.net/~coffeys/webrev.8011215.ivan/
>
>
>   The "master" version of CopyOnWriteArrayList is here:
>
> http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/CopyOnWriteArrayList.java?view=markup
>
>    Thanks for the link!
> I see that the code in the master version is identical to the one I've
> been working on.
> So the optimization still could be applied.
>
> Sincerely,
> Ivan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130402/3a847686/attachment.html>


More information about the Concurrency-interest mailing list