JMH
Java Microbenchmark Harness (JMH) is a Java toolkit for building, running, and analyzing microbenchmarks on the Java Virtual Machine. It is designed to produce accurate, repeatable measurements by controlling warmup, compilation, garbage collection, and other JVM effects, often by executing benchmarks in isolated forked JVM processes.
Benchmarks are authored as Java methods annotated with @Benchmark inside a class annotated with @State. The
Key features include support for multiple measurement modes (Throughput, AverageTime, SampleTime, SingleShotTime), parameterization with @Param, and
Usage typically involves integrating with build tools such as Maven or Gradle through dedicated plugins, or
JMH is widely used in the Java ecosystem to obtain reliable microbenchmark measurements and to compare alternative