RFR: 8332842: Optimize empty CopyOnWriteArrayList allocations [v2]

jengebr duke at openjdk.org
Wed Jun 5 14:59:00 UTC 2024


On Tue, 4 Jun 2024 19:58:41 GMT, jengebr <duke at openjdk.org> wrote:

>> Agreed. You might as well be consistent with this so that no one will need to re-address if some application does zillions of clones of empty lists.
>
> Sorry, I crossed wires with @DougLea 's comment, will add `clone`.

`clone()` performs a shallow copy, so there is currently no `Object[]` allocated and therefore nothing to optimize.  I don't think there's any work to do here.

@DougLea @viktorklang-ora can you confirm?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19527#discussion_r1627947686


More information about the core-libs-dev mailing list