0Pricing
Java Academy · Lesson

Warmup and Iterations

Measure steady-state performance.

Warmup and Iterations

JMH measures steady-state performance: the speed your code reaches after the JVM has fully optimized it. To do that it runs throwaway warmup iterations first, then real measurement iterations. This lesson covers tuning both.

Why Warm Up

Early invocations run interpreted and are slow; after the JIT compiles the hot method, calls become much faster. Including the slow startup in your numbers would inflate them. Warmup iterations execute the code but their timings are discarded.

All lessons in this course

  1. Why JMH
  2. Writing a Benchmark
  3. Warmup and Iterations
  4. Avoiding Dead-Code Elimination
← Back to Java Academy