In this chapter, the reader will be introduced to a Java Microbenchmark Harness (JMH) project that allows for measuring various code performance characteristics. If performance is an important issue for your application, this tool can help you to identify bottlenecks with precision—up to the method level. Using it, the reader will be able to not only measure the average execution time of the code and other performance values (such as throughput, for example) but to do it in a controlled manner—with or without the JVM optimizations, warmup runs, and so on.
In addition to theoretical knowledge, the reader will have a chance to run JMH using practical demo examples and recommendations.
The following topics will be covered in this chapter:
- What is JMH?
- Creating a JMH benchmark
- Running the benchmark
- Using the IDE plugin
- JMH benchmark parameters...