<i18n dev> RFR: 8345668: ZoneOffset.ofTotalSeconds performance regression [v3]

Archie Cobbs acobbs at openjdk.org
Fri Dec 27 16:29:41 UTC 2024


On Thu, 26 Dec 2024 17:25:55 GMT, Andrey Turbanov <aturbanov at 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


More information about the i18n-dev mailing list