JMH Tutorial: Writing Java Microbenchmarks That Don’t Lie
A beginner-first JMH tutorial, verified on JDK 25 and JMH 1.37: dead-code elimination, Blackhole, constant folding, warmup, forks, state scopes, -prof gc and percentiles, each shown with real captured output.