Chapter 8. Microbenchmarking Applications with JMH
In the previous chapter, we took an in-depth review of garbage collection to include an object life cycle, garbage collection algorithms, garbage collection options, and methods related to garbage collection. We took a brief look at upgrades to garbage collection in Java 8 and focused on changes with the new Java 9 platform. Our exploration of garbage collection in Java 9 included looks at default garbage collection, depreciated garbage collection combinations, unified garbage collection logging, and garbage collection issues that persist, even after Java 9.
In this chapter, we will look at how to write performance tests using the Java Microbenchmark Harness (JMH), a Java harness library for writing benchmarks for the Java Virtual Machine (JVM). We will use Maven along with JMH to help illustrate the power of microbenchmarking with the new Java 9 platform.
Specifically, we will cover the following topics:
- Microbenchmarking overview
- Microbenchmarking...