jmh-basics: JMH tutorial module (dead-code elimination, Blackhole, constant folding, warmup/forks, state scopes, -prof gc)
Eight benchmark/demo classes, a deterministic test suite, and 12 captured output files generated by scripts/run-all.sh on JDK 25.0.5 (Temurin) with JMH 1.37. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6Fj2JNt7dRev4pZPe
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
# JMH version: 1.37
|
||||
# VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS
|
||||
# VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java
|
||||
# Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
|
||||
# Warmup: 3 iterations, 1 s each
|
||||
# Measurement: 3 iterations, 1 s each
|
||||
# Timeout: 10 min per iteration
|
||||
# Threads: 1 thread, will synchronize iterations
|
||||
# Benchmark mode: Average time, time/op
|
||||
# Benchmark: com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes
|
||||
|
||||
# Run progress: 0.00% complete, ETA 00:00:18
|
||||
# Fork: 1 of 1
|
||||
# Warmup Iteration 1: 7.135 ns/op
|
||||
# Warmup Iteration 2: 5.665 ns/op
|
||||
# Warmup Iteration 3: 5.072 ns/op
|
||||
Iteration 1: 5.345 ns/op
|
||||
gc.alloc.rate: 5707.275 MB/sec
|
||||
gc.alloc.rate.norm: 32.000 B/op
|
||||
gc.count: 18.000 counts
|
||||
gc.time: 21.000 ms
|
||||
|
||||
Iteration 2: 5.649 ns/op
|
||||
gc.alloc.rate: 5400.357 MB/sec
|
||||
gc.alloc.rate.norm: 32.000 B/op
|
||||
gc.count: 18.000 counts
|
||||
gc.time: 22.000 ms
|
||||
|
||||
Iteration 3: 5.596 ns/op
|
||||
gc.alloc.rate: 5448.664 MB/sec
|
||||
gc.alloc.rate.norm: 32.000 B/op
|
||||
gc.count: 17.000 counts
|
||||
gc.time: 22.000 ms
|
||||
|
||||
|
||||
|
||||
Result "com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes":
|
||||
5.530 ±(99.9%) 2.966 ns/op [Average]
|
||||
(min, avg, max) = (5.345, 5.530, 5.649), stdev = 0.163
|
||||
CI (99.9%): [2.564, 8.496] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes:gc.alloc.rate":
|
||||
5518.765 ±(99.9%) 3010.780 MB/sec [Average]
|
||||
(min, avg, max) = (5400.357, 5518.765, 5707.275), stdev = 165.031
|
||||
CI (99.9%): [2507.986, 8529.545] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes:gc.alloc.rate.norm":
|
||||
32.000 ±(99.9%) 0.001 B/op [Average]
|
||||
(min, avg, max) = (32.000, 32.000, 32.000), stdev = 0.001
|
||||
CI (99.9%): [32.000, 32.000] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes:gc.count":
|
||||
53.000 ±(99.9%) 0.001 counts [Sum]
|
||||
(min, avg, max) = (17.000, 17.667, 18.000), stdev = 0.577
|
||||
CI (99.9%): [53.000, 53.000] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.arrayEscapes:gc.time":
|
||||
65.000 ±(99.9%) 0.001 ms [Sum]
|
||||
(min, avg, max) = (21.000, 21.667, 22.000), stdev = 0.577
|
||||
CI (99.9%): [65.000, 65.000] (assumes normal distribution)
|
||||
|
||||
|
||||
# JMH version: 1.37
|
||||
# VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS
|
||||
# VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java
|
||||
# Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
|
||||
# Warmup: 3 iterations, 1 s each
|
||||
# Measurement: 3 iterations, 1 s each
|
||||
# Timeout: 10 min per iteration
|
||||
# Threads: 1 thread, will synchronize iterations
|
||||
# Benchmark mode: Average time, time/op
|
||||
# Benchmark: com.ankurm.jmhbasics.AllocationBenchmark.doesNotEscape
|
||||
|
||||
# Run progress: 33.33% complete, ETA 00:00:12
|
||||
# Fork: 1 of 1
|
||||
# Warmup Iteration 1: 0.664 ns/op
|
||||
# Warmup Iteration 2: 0.732 ns/op
|
||||
# Warmup Iteration 3: 0.754 ns/op
|
||||
Iteration 1: 1.044 ns/op
|
||||
gc.alloc.rate: 0.007 MB/sec
|
||||
gc.alloc.rate.norm: ≈ 10⁻⁵ B/op
|
||||
gc.count: ≈ 0 counts
|
||||
|
||||
Iteration 2: 0.849 ns/op
|
||||
gc.alloc.rate: 0.007 MB/sec
|
||||
gc.alloc.rate.norm: ≈ 10⁻⁵ B/op
|
||||
gc.count: ≈ 0 counts
|
||||
|
||||
Iteration 3: 0.774 ns/op
|
||||
gc.alloc.rate: 0.007 MB/sec
|
||||
gc.alloc.rate.norm: ≈ 10⁻⁵ B/op
|
||||
gc.count: ≈ 0 counts
|
||||
|
||||
|
||||
|
||||
Result "com.ankurm.jmhbasics.AllocationBenchmark.doesNotEscape":
|
||||
0.889 ±(99.9%) 2.544 ns/op [Average]
|
||||
(min, avg, max) = (0.774, 0.889, 1.044), stdev = 0.139
|
||||
CI (99.9%): [≈ 0, 3.432] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.doesNotEscape:gc.alloc.rate":
|
||||
0.007 ±(99.9%) 0.001 MB/sec [Average]
|
||||
(min, avg, max) = (0.007, 0.007, 0.007), stdev = 0.001
|
||||
CI (99.9%): [0.007, 0.007] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.doesNotEscape:gc.alloc.rate.norm":
|
||||
≈ 10⁻⁵ B/op
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.doesNotEscape:gc.count":
|
||||
≈ 0 counts
|
||||
|
||||
|
||||
# JMH version: 1.37
|
||||
# VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS
|
||||
# VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java
|
||||
# Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
|
||||
# Warmup: 3 iterations, 1 s each
|
||||
# Measurement: 3 iterations, 1 s each
|
||||
# Timeout: 10 min per iteration
|
||||
# Threads: 1 thread, will synchronize iterations
|
||||
# Benchmark mode: Average time, time/op
|
||||
# Benchmark: com.ankurm.jmhbasics.AllocationBenchmark.escapes
|
||||
|
||||
# Run progress: 66.67% complete, ETA 00:00:06
|
||||
# Fork: 1 of 1
|
||||
# Warmup Iteration 1: 6.088 ns/op
|
||||
# Warmup Iteration 2: 4.657 ns/op
|
||||
# Warmup Iteration 3: 4.507 ns/op
|
||||
Iteration 1: 4.959 ns/op
|
||||
gc.alloc.rate: 4609.827 MB/sec
|
||||
gc.alloc.rate.norm: 24.000 B/op
|
||||
gc.count: 16.000 counts
|
||||
gc.time: 20.000 ms
|
||||
|
||||
Iteration 2: 4.719 ns/op
|
||||
gc.alloc.rate: 4843.713 MB/sec
|
||||
gc.alloc.rate.norm: 24.000 B/op
|
||||
gc.count: 17.000 counts
|
||||
gc.time: 21.000 ms
|
||||
|
||||
Iteration 3: 4.898 ns/op
|
||||
gc.alloc.rate: 4671.068 MB/sec
|
||||
gc.alloc.rate.norm: 24.000 B/op
|
||||
gc.count: 16.000 counts
|
||||
gc.time: 18.000 ms
|
||||
|
||||
|
||||
|
||||
Result "com.ankurm.jmhbasics.AllocationBenchmark.escapes":
|
||||
4.859 ±(99.9%) 2.271 ns/op [Average]
|
||||
(min, avg, max) = (4.719, 4.859, 4.959), stdev = 0.124
|
||||
CI (99.9%): [2.588, 7.130] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.escapes:gc.alloc.rate":
|
||||
4708.203 ±(99.9%) 2212.682 MB/sec [Average]
|
||||
(min, avg, max) = (4609.827, 4708.203, 4843.713), stdev = 121.285
|
||||
CI (99.9%): [2495.521, 6920.885] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.escapes:gc.alloc.rate.norm":
|
||||
24.000 ±(99.9%) 0.001 B/op [Average]
|
||||
(min, avg, max) = (24.000, 24.000, 24.000), stdev = 0.001
|
||||
CI (99.9%): [24.000, 24.000] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.escapes:gc.count":
|
||||
49.000 ±(99.9%) 0.001 counts [Sum]
|
||||
(min, avg, max) = (16.000, 16.333, 17.000), stdev = 0.577
|
||||
CI (99.9%): [49.000, 49.000] (assumes normal distribution)
|
||||
|
||||
Secondary result "com.ankurm.jmhbasics.AllocationBenchmark.escapes:gc.time":
|
||||
59.000 ±(99.9%) 0.001 ms [Sum]
|
||||
(min, avg, max) = (18.000, 19.667, 21.000), stdev = 1.528
|
||||
CI (99.9%): [59.000, 59.000] (assumes normal distribution)
|
||||
|
||||
|
||||
# Run complete. Total time: 00:00:19
|
||||
|
||||
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
|
||||
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
|
||||
experiments, perform baseline and negative tests that provide experimental control, make sure
|
||||
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
|
||||
Do not assume the numbers tell you what you want them to tell.
|
||||
|
||||
NOTE: Current JVM experimentally supports Compiler Blackholes, and they are in use. Please exercise
|
||||
extra caution when trusting the results, look into the generated code to check the benchmark still
|
||||
works, and factor in a small probability of new VM bugs. Additionally, while comparisons between
|
||||
different JVMs are already problematic, the performance difference caused by different Blackhole
|
||||
modes can be very significant. Please make sure you use the consistent Blackhole mode for comparisons.
|
||||
|
||||
Benchmark Mode Cnt Score Error Units
|
||||
AllocationBenchmark.arrayEscapes avgt 3 5.530 ± 2.966 ns/op
|
||||
AllocationBenchmark.arrayEscapes:gc.alloc.rate avgt 3 5518.765 ± 3010.780 MB/sec
|
||||
AllocationBenchmark.arrayEscapes:gc.alloc.rate.norm avgt 3 32.000 ± 0.001 B/op
|
||||
AllocationBenchmark.arrayEscapes:gc.count avgt 3 53.000 counts
|
||||
AllocationBenchmark.arrayEscapes:gc.time avgt 3 65.000 ms
|
||||
AllocationBenchmark.doesNotEscape avgt 3 0.889 ± 2.544 ns/op
|
||||
AllocationBenchmark.doesNotEscape:gc.alloc.rate avgt 3 0.007 ± 0.001 MB/sec
|
||||
AllocationBenchmark.doesNotEscape:gc.alloc.rate.norm avgt 3 ≈ 10⁻⁵ B/op
|
||||
AllocationBenchmark.doesNotEscape:gc.count avgt 3 ≈ 0 counts
|
||||
AllocationBenchmark.escapes avgt 3 4.859 ± 2.271 ns/op
|
||||
AllocationBenchmark.escapes:gc.alloc.rate avgt 3 4708.203 ± 2212.682 MB/sec
|
||||
AllocationBenchmark.escapes:gc.alloc.rate.norm avgt 3 24.000 ± 0.001 B/op
|
||||
AllocationBenchmark.escapes:gc.count avgt 3 49.000 counts
|
||||
AllocationBenchmark.escapes:gc.time avgt 3 59.000 ms
|
||||
Reference in New Issue
Block a user