java - JMH difference between Sample and SingleShot -
what's difference between setting mode.sample
, mode.singleshot
measurementiterations
set large number? same or there quantitive difference between 2 modes?
but... javadoc states difference quite specifically?
sample time: samples time each operation.
runs continuously calling {@link benchmark} methods, , randomly samples time needed call. mode automatically adjusts sampling frequency, may omit pauses missed sampling measurement. mode time-based, , run until iteration time expires.
and:
single shot time: measures time single operation.
runs calling {@link benchmark} once , measuring time. mode useful estimate "cold" performance when don't want hide warmup invocations, or if want see progress call call, or want record every single sample. mode work-based, , run single invocation of {@link benchmark} method.
caveats mode include:
- more warmup/measurement iterations required.
- timers overhead might significant if benchmarks small; switch {@link #sampletime} mode if problem.
Comments
Post a Comment