RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v3]

Alan Bateman alanb at openjdk.org
Wed Aug 14 13:30:57 UTC 2024


On Wed, 19 Jun 2024 12:52:46 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> @AlanBateman -- could you please take a look? Thanks.
>
>> @AlanBateman -- could you please take a look? Thanks.
> 
> There was a lot of heap analysis done a few years ago that shined a light on the number of empty collections in a typical heap. I don't recall seeing COWAL in any of the data but it seems plausible that there are cases where there are a lot of empty COWAL instances in the heap.
> 
> Main thing for a change like this to make sure it doesn't hurt other cases and check if there are overridable methods used in the existing + updated implementations that might get reported as a behavior change by something that extends and overrides some methods. I don't see anything so I think it's okay.
> 
> One thing that surprises me is the change to remove(Object) to handle the case where the last remaining element is removed. Does that help the application that prompted this change? Part of me wonders if remove(int) needs to do the same as someone will show up sometime to ask.

> @AlanBateman review please.

Yes, I think this is okay.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19527#issuecomment-2288745837


More information about the core-libs-dev mailing list