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

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Apr 2 18:33:10 EDT 2013


On 03.04.2013 1:17, Martin Buchholz wrote:
> Have you benchmarked the case where the element is never present?
That's the only case I've tested.
If the element were in the array, my code would obviously win.

> (with the usual caveats about micro-benchmarking - perhaps use google 
> caliper?)
The tests I wrote are quite simple - they just run a code snippet for 
several hundreds of times.
I've just sent and archive with the tests in reply to the other message 
in the thread.

>
> On Tue, Apr 2, 2013 at 2:11 PM, Ivan Gerasimov 
> <ivan.gerasimov at oracle.com <mailto:ivan.gerasimov at oracle.com>> wrote:
>
>
>     I've done a little testing on my side.
>     I used Integer as an underlying type and set length of the array
>     to the values from 1 to 100.
>     My code shows a little performance gain - approximately 9%.
>     I understand it may not be there for all cases, but at least for
>     some cases it is there.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130403/389d16a8/attachment.html>


More information about the Concurrency-interest mailing list