RFR: 8276054: JMH benchmarks for Fences [v2]

Aleksey Shipilev shade at openjdk.java.net
Wed Oct 27 16:43:53 UTC 2021


> 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

Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:

  Proper package name

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6138/files
  - new: https://git.openjdk.java.net/jdk/pull/6138/files/183e70ac..c1e7905d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6138&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6138&range=00-01

  Stats: 5 lines in 5 files changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6138.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6138/head:pull/6138

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


More information about the hotspot-dev mailing list