On Thu, 26 Dec 2024 17:25:55 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:
> For sure we should use result of `putIfAbsent` Drive-by comment... >From what i can infer, the performance regression being addressed here is >caused in part by the fact that (for example) >`ConcurrentHashMap.computeIfAbsent()` provides an atomicity guarantee, which >is a stronger requirement than is necessary here, and therefore by splitting >up that call up into two separate, non-atomic `get()` and `put()` calls we get >(counter-intuitively) faster execution time, even though there are more lines >of code. Note `putIfAbsent()` also guarantees atomicity, so the same problem >of slowness caused by "unnecessary atomicity" might occur with it as well. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22854#discussion_r1898609222