What is the purpose of the JMH (Java Microbenchmarking Harness) framework?
JMH is used to measure the throughput and latency of Java programs, but only in the context of multi-threaded applications.
Thatâ€™s partially correct. JMH can measure throughput and latency, but it's not restricted to just multi-threaded applications.
Can you explain how JMH helps reduce common benchmarking pitfalls like JVM optimizations during testing?