RFR: 8281631: HashMap copy constructor and putAll can over-allocate table [v21]
liach
duke at openjdk.java.net
Sun Feb 20 19:52:49 UTC 2022
On Sun, 20 Feb 2022 19:41:22 GMT, XenoAmess <duke at openjdk.java.net> wrote:
>> In fact, if we do worry about the performance of adding from maps, calling `map.forEach(this::put);` would be a better alternative both in concurrency (as the concurrent map itself takes charage) and object allocation-wise (no allocation of immutable entry objects), but that belongs to another issue.
>
> @liach Hi. please have a look at the latest commit.
> do you think it be better now?
Oops, didn't notice there was this helpful `init` method. Does look much more straightforward now.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7431
More information about the core-libs-dev
mailing list