RFR: 8322149: ConcurrentHashMap smarter presizing for copy constructor and putAll [v3]
Volker Simonis
simonis at openjdk.org
Tue Jan 23 17:20:33 UTC 2024
On Mon, 22 Jan 2024 22:10:44 GMT, Joshua Cao <duke at openjdk.org> 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
More information about the core-libs-dev
mailing list