Java Microbenchmark Harness
Benchmarking is critical to the ability to measure performance. JMH is a toolkit used to implement rigorous benchmarks. This section explores JMH and its key features and provides implementation examples.
Java Microbenchmark Harness (JMH)
JMH is used to build and implement benchmarks to analyze the performance of Java code. It was written in Java by the team that created the Java Virtual Machine (JVM).
Developers that use JMH can measure the performance of Java code snippets with repeatable and controlled conditions.
Key features
JMH is an open source toolkit used to build and implement benchmarks at the nano, micro, and macro levels. JMH is more than a performance tester; it is designed to overcome or avoid common performance measurement pitfalls, including warm-up times and the effects of just-in-time (JIT) compilations.
Key features of the JMH toolkit include the following:
- Annotations: As you will see in the next section, JMH...