On Wed, 12 Mar 2025 14:14:59 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> You can probably use `acquire` only for the first `get` as it is in the fast >> path. For other I guess `volatile` is fine. > > Yeah. Maybe that could strike a balance. On an M1 Mac: Volatile: StableValueBenchmark.stable avgt 10 1.373 ? 0.057 ns/op StableValueBenchmark.stableNull avgt 10 1.245 ? 0.074 ns/op Acquire: StableValueBenchmark.stable avgt 10 1.339 ? 0.044 ns/op StableValueBenchmark.stableNull avgt 10 1.241 ? 0.090 ns/op We would have to examine the difference on other platforms as well. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1993284760