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:
2026-11-08 18:31:11 +00:00
co-authored by Claude Sonnet 5.5
parent f6237d4117
commit db129fb1ce
27 changed files with 2018 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
# 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: 10 iterations, 200 ms each
# Measurement: 5 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.SortBenchmark.sortCopy
# Run progress: 0.00% complete, ETA 00:00:07
# Fork: 1 of 1
# Warmup Iteration 1: 9.502 us/op
# Warmup Iteration 2: 7.662 us/op
# Warmup Iteration 3: 4.997 us/op
# Warmup Iteration 4: 4.586 us/op
# Warmup Iteration 5: 4.362 us/op
# Warmup Iteration 6: 6.260 us/op
# Warmup Iteration 7: 6.648 us/op
# Warmup Iteration 8: 5.701 us/op
# Warmup Iteration 9: 4.546 us/op
# Warmup Iteration 10: 4.359 us/op
Iteration 1: 5.683 us/op
Iteration 2: 6.121 us/op
Iteration 3: 4.753 us/op
Iteration 4: 4.963 us/op
Iteration 5: 5.553 us/op
Result "com.ankurm.jmhbasics.SortBenchmark.sortCopy":
5.414 ±(99.9%) 2.138 us/op [Average]
(min, avg, max) = (4.753, 5.414, 6.121), stdev = 0.555
CI (99.9%): [3.277, 7.552] (assumes normal distribution)
# Run complete. Total time: 00:00:07
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
SortBenchmark.sortCopy avgt 5 5.414 ± 2.138 us/op