RFR [8011215] optimization of CopyOnWriteArrayList.addIfAbsent()
Ivan Gerasimov
ivan.gerasimov at oracle.com
Tue Apr 2 22:33:10 UTC 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.
>
More information about the core-libs-dev
mailing list