On Wed, 3 Jan 2024 19:52:34 GMT, Joshua Cao <d...@openjdk.org> wrote:

>> test/micro/org/openjdk/bench/java/util/concurrent/Maps.java line 122:
>> 
>>> 120:     public void testCopyConstructor() {
>>> 121:         ConcurrentHashMap<Integer, Integer> clone = new 
>>> ConcurrentHashMap<>(staticMap);
>>> 122:         dummy = clone;
>> 
>> Is this for preventing dead-code elimination? If so, just do:
>> 
>> 
>>   return new ConcurrentHashMap<>(staticMap);
>
> I tried this. I don't think its working. When I just return the map, we lose 
> the improvements in performance, and the benchmark overall just runs much 
> faster. I'm guessing the map got DCE'ed

Scratch that. Was my mistake. Was running the wrong test.

I'm renaming `testCopyConstructor` to `testConcurrentHashMapCopyConstructor`, 
since the file name + test don't actually explicitly say its for 
ConcurrentHashMap.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17116#discussion_r1440968465

Reply via email to