On Mon, 5 May 2025 13:41:22 GMT, Per Minborg <pminb...@openjdk.org> wrote:

> This sketch shows how "Stable Updaters" can be used to create stable 
> computations of `@Stable` fields. Only one updater is needed per class, 
> similar to `AtomicIntegerFieldUpdater`.

Benchmarks:


Benchmark                        Mode  Cnt  Score   Error  Units
StableUpdatersBenchmark.base     avgt   10  0.715 ± 0.026  ns/op
StableUpdatersBenchmark.updater  avgt   10  0.716 ± 0.079  ns/op


Which shows the updater has the same performance as imperative code which is 
good.

Updated benchmarks:


Benchmark                              Mode  Cnt  Score   Error  Units
StableUpdatersBenchmark.base           avgt   10  0.838 ± 0.041  ns/op
StableUpdatersBenchmark.baseStatic     avgt   10  0.759 ± 0.088  ns/op
StableUpdatersBenchmark.updater        avgt   10  0.888 ± 0.086  ns/op
StableUpdatersBenchmark.updaterStatic  avgt   10  0.753 ± 0.017  ns/op
StableUpdatersBenchmark.uri            avgt   10  0.781 ± 0.206  ns/op
StableUpdatersBenchmark.uriStatic      avgt   10  0.724 ± 0.048  ns/op

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

PR Comment: https://git.openjdk.org/jdk/pull/25040#issuecomment-2851073331
PR Comment: https://git.openjdk.org/jdk/pull/25040#issuecomment-2853800652

Reply via email to