Integrated: 8276054: JMH benchmarks for Fences

Aleksey Shipilev shade at openjdk.java.net
Thu Oct 28 17:37:23 UTC 2021


On Wed, 27 Oct 2021 12:11:37 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> While working on JDK-8252990, I realized there are no microbenchmarks for Fences. I would be good to add some. While technically we can benchmark `Unsafe` directly, I instead chose to use the public API, `VarHandles`, as this captures the real-world uses too.
> 
> Sample output for `make test TEST=micro:vm.fences` on `x86_64`:
> 
> 
> Benchmark                      Mode  Cnt  Score    Error  Units
> Multiple.acquire               avgt    9  0.408 ±  0.005  ns/op
> Multiple.full                  avgt    9  4.694 ±  0.003  ns/op
> Multiple.plain                 avgt    9  0.407 ±  0.004  ns/op
> Multiple.release               avgt    9  0.407 ±  0.003  ns/op
> Multiple.storeStore            avgt    9  0.409 ±  0.006  ns/op
> MultipleWithLoads.acquire      avgt    9  4.600 ±  0.002  ns/op
> MultipleWithLoads.full         avgt    9  8.322 ±  0.003  ns/op
> MultipleWithLoads.plain        avgt    9  4.328 ±  0.001  ns/op
> MultipleWithLoads.release      avgt    9  4.600 ±  0.002  ns/op
> MultipleWithLoads.storeStore   avgt    9  4.600 ±  0.002  ns/op
> MultipleWithStores.acquire     avgt    9  0.812 ±  0.001  ns/op
> MultipleWithStores.full        avgt    9  5.291 ±  0.001  ns/op
> MultipleWithStores.plain       avgt    9  0.812 ±  0.001  ns/op
> MultipleWithStores.release     avgt    9  0.812 ±  0.001  ns/op
> MultipleWithStores.storeStore  avgt    9  0.812 ±  0.001  ns/op
> SafePublishing.plain           avgt    9  6.378 ±  0.011  ns/op
> SafePublishing.release         avgt    9  6.368 ±  0.010  ns/op
> SafePublishing.storeStore      avgt    9  6.376 ±  0.013  ns/op
> Single.acquireFence            avgt    9  0.410 ±  0.009  ns/op
> Single.fullFence               avgt    9  4.689 ±  0.002  ns/op
> Single.plain                   avgt    9  0.409 ±  0.010  ns/op
> Single.releaseFence            avgt    9  0.410 ±  0.006  ns/op
> Single.storeStoreFence         avgt    9  0.410 ±  0.009  ns/op

This pull request has now been integrated.

Changeset: 5a768f75
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/5a768f75c9cb013edbf6c61e79820bd180cad4ba
Stats:     451 lines in 5 files changed: 451 ins; 0 del; 0 mod

8276054: JMH benchmarks for Fences

Reviewed-by: redestad

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

PR: https://git.openjdk.java.net/jdk/pull/6138


More information about the hotspot-dev mailing list