Thanks as always to Jason, our master Historian.
On Wed, Dec 19, 2018 at 2:14 AM Steve Groeger wrote:
>
> 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 backi
es with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
From: Jason Mehrens
To: Martin Buchholz , Stuart Marks
Cc: core-libs
Date: 19/12/2018 04:54
Subject: Re: Proposal: ArrayList constructor perforrmance
improvement
Sent by:
>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
Subject: 6347106 (coll) Make ArrayList(Collection) more threadsafe
Sender:
To: Jason Mehrens
Hi Jason,
Thanks for
Sorry for not having remembered the history.
Having ArrayList(Collection) delegate to toArray was done for performance
and robustness.
We don't want to change the "trimming" behavior of collection copying,
because trimming by copying is a common idiom (we never added trimming
methods to all the col
On 12/18/18 1:49 PM, Jason Mehrens wrote:
The reason the patched code is faster is because it will avoid an array resize
that is triggered in the benchmark by:
"// once a new ArrayList is created add a new element
al.add(new Integer(900));"
http://cr.openjdk.java.net/~sgroeger/perf
On 12/18/18 9:23 AM, Martin Buchholz wrote:
The blessed solution to the list copy problem is probably List.copyOf
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#copyOf(java.util.Collection)
which might do the optimization you're hoping for.
List.copyOf is fine,
The reason the patched code is faster is because it will avoid an array resize
that is triggered in the benchmark by:
"// once a new ArrayList is created add a new element
al.add(new Integer(900));"
http://cr.openjdk.java.net/~sgroeger/perf/arraylist/ArrayListBenchmark.java
If you look
> On Dec 18, 2018, at 12:58 PM, Jason Mehrens wrote:
>
> Hi Steve,
>
>> ArrayList has a constructor which takes an arbitrary Collection as a
>> parameter. This constructor will create an iterator over the collection
>> ;and it will add each entry returned to the ArrayList.
>
>> We have fou
Hi Steve,
>ArrayList has a constructor which takes an arbitrary Collection as a
>parameter. This constructor will create an iterator over the collection
>;and it will add each entry returned to the ArrayList.
>We have found that quite a lot of the time the object passed as a
>parameter is in
On 18/12/2018 16:44, Steve Groeger wrote:
Hi all,
I am proposing an enhancement to ArrayList.java to improve its
performance.
ArrayList has a constructor which takes an arbitrary Collection as a
parameter. This constructor will create an iterator over the collection
and it will add each entry r
This is no question that we can optimize the case of ArrayList ->
ArrayList, but what about all the other Collection
implementations? ArrayDeque and CopyOnWriteArrayList come to mind.
ArrayList is a popular class to use for making copies of Collections.
Where do you stop?
A pathological subclass
Hi all,
I am proposing an enhancement to ArrayList.java to improve its
performance.
ArrayList has a constructor which takes an arbitrary Collection as a
parameter. This constructor will create an iterator over the collection
and it will add each entry returned to the ArrayList.
We have foun
12 matches
Mail list logo