RFR: 8322149: ConcurrentHashMap copy constructor should not transfer from old table on presizing [v2]
Joshua Cao
duke at openjdk.org
Wed Jan 17 21:16:03 UTC 2024
On Fri, 12 Jan 2024 08:51:16 GMT, Volker Simonis <simonis at openjdk.org> wrote:
>>> tryPresize(int size) is doing and if its size argument is supposed to contain the additional number of elements which will be inserted into the hash map or if it is a hint for the new total size of the hash map
>>
>> Argument `size` for `tryPresize()` is a hint for the **new total size** of the hash map. If the size is too small compared to the current size of the map, there will be no resizing.
>
> Thanks. In that case, calling `tryPresize()` with `size < this.size()` doesn't make sense and we should call it with `this.size() + m.size()`.
Thanks. Just committed this change. Also added a new benchmark for `putAll()` and the results in the top post.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17116#discussion_r1456490539
More information about the core-libs-dev
mailing list