On Mon, 22 Jan 2024 22:10:44 GMT, Joshua Cao <[email protected]> wrote:
>> test/micro/org/openjdk/bench/java/util/concurrent/Maps.java line 122:
>>
>>> 120: @Benchmark
>>> 121: public ConcurrentHashMap<Integer, Integer>
>>> testConcurrentHashMapPutAll() {
>>> 122: ConcurrentHashMap<Integer, Integer> map = new
>>> ConcurrentHashMap<>();
>>
>> I think this benchmark could be made more accurate by creating the new,
>> temporary map with the right initial size (i.e.
>> `ConcurrentHashMap<>(nkeys)`) to avoid calls to `tryPresize()` in this setup
>> step.
>
> I updated. The numbers are surprisingly the same. I guess the benchmark
> compute time is dominated by putAll().
OK, thanks nevertheless.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17116#discussion_r1463660578