I take a look at JMH tool.
In sample file JMHSample_03_States they says:
============================== HOW TO RUN THIS TEST: ====================================
You are expected to see the drastic difference in shared and unshared cases,
because you either contend for single memory location, or not. This effect
is more articulated on large machines.
You can run this test:
a) Via the command line:
$ mvn clean install
$ java -jar target/benchmarks.jar JMHSample_03 -wi 5 -i 5 -t 4 -f 1
(we requested 5 measurement/warmup iterations, with 4 threads, single fork)
My result for java 1.8.20.0 and Intel i5-4670K CPU @ 3.40GHz
# Run complete. Total time: 00:00:24
Benchmark Mode Samples Score Score error Units
o.s.JMHSample_03_States.measureShared thrpt 5 1547894580.996 3632128.044 ops/s
o.s.JMHSample_03_States.measureUnshared thrpt 5 1571371998.011 6150584.658 ops/s
What is the "drastic difference"? Difference between measureShared (1547894580) and measureUnshared (1571371998) less then 2%