What's the difference between setting Mode.Sample
and Mode.SingleShot
together with measurementIterations
set to large number? Is it effectively the same or is there some quantitive difference between the two modes?
But... Javadoc states the difference quite specifically?
Sample time: samples the time for each operation.
Runs by continuously calling {@link Benchmark} methods, and randomly samples the time needed for the call. This mode automatically adjusts the sampling frequency, but may omit some pauses which missed the sampling measurement. This mode is time-based, and it will run until the iteration time expires.
And:
Single shot time: measures the time for a single operation.
Runs by calling {@link Benchmark} once and measuring its time. This mode is useful to estimate the "cold" performance when you don't want to hide the warmup invocations, or if you want to see the progress from call to call, or you want to record every single sample. This mode is work-based, and will run only for a single invocation of {@link Benchmark} method.
Caveats for this mode include:
- More warmup/measurement iterations are generally required.
- Timers overhead might be significant if benchmarks are small; switch to {@link #SampleTime} mode if that is a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With