Jason & Stuart, 

Yes, the intent was to leave the backing array the same size in order to 
avoid to have the resize of it when a new element is added. 
So, if someone wanted to reduce the size of the backing array then they 
could use the ArrayList.trimToSize() method.

However, if you are saying (in another post - 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-December/057560.html
)  that the 'trimming' of the backing array on a copy is intentional and 
that you are OK with a subsequent addition then resizing the backing array 
again - causing 2 resize operations, then this makes this performance 
change a moot issue. 

I can also see that not trimming on a copy is a change in the behavior and 
could cause problems with existing usages of this behavior.

I thank you for all your comments and suggestions but it seems this change 
will not be suitable. 

Thanks
Steve Groeger
IBM Runtime Technologies
Hursley, Winchester
Tel: (44) 1962 816911  Mobex: 279990  Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groe...@uk.ibm.com

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



From:   Jason Mehrens <jason_mehr...@hotmail.com>
To:     Martin Buchholz <marti...@google.com>, Stuart Marks 
<stuart.ma...@oracle.com>
Cc:     core-libs <core-libs-dev@openjdk.java.net>
Date:   19/12/2018 04:54
Subject:        Re: Proposal: ArrayList constructor perforrmance 
improvement
Sent by:        "core-libs-dev" <core-libs-dev-boun...@openjdk.java.net>



>Sorry for not having remembered the history.

**Start the wavy motion effect because we are going back in time!

======
Date: Wed, 27 Sep 2006 16:49:47 -0700
From: Martin Buchholz <martin.buchh...@sun.com>
Subject: 6347106 (coll) Make ArrayList(Collection) more threadsafe
Sender: <martin.buchh...@sun.com>
To: Jason Mehrens <jason_mehr...@hotmail.com>

Hi Jason,

Thanks for the SDN comment.
I updated 4759223 and 4918916.

I closed 4759223 as a dup of 6347106, but
4918916 is still an issue (although I should probably close as
Not a Defect, following Josh).
======

So most of the history is in the following:
https://bugs.openjdk.java.net/browse/JDK-4918916

https://bugs.openjdk.java.net/browse/JDK-4759223

https://bugs.openjdk.java.net/browse/JDK-6347106


Yes I still have this email and that Sun Ultra 20 from the Mustang 
Regressions challenge :)

Jason






Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Reply via email to