There are many benchmark parameters that allow for fine-tuning the measurements for the particular needs of the task at hand. We are going to present only the major ones.
JMH benchmark parameters
Mode
The first set of parameters defines the performance aspect (mode) the particular benchmark has to measure:
- Mode.AverageTime: Measures the average execution time
- Mode.Throughput: Measures the throughput by calling the benchmark method in an iteration
- Mode.SampleTime: Samples the execution time, instead of averaging it; allows us to infer the distributions, percentiles, and so on
- Mode.SingleShotTime: Measures the single method invocation time; allows for the testing of a cold startup without calling the benchmark method continuously...