Fixture&State settings and impact on measurement (original) (raw)

Yann Le Tallec ylt at letallec.org
Fri May 17 10:56:47 PDT 2013


Hello,

Here is a trivial benchmark:

@State(Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) public class StateAndFixture { @Setup(Level.Iteration) public void setup() {}

@GenerateMicroBenchmark(BenchmarkType.AverageTimePerOp)
public void baseline() {}

}

Here are the average run times measured on my machine with different settings:

@State(Scope.Thread) / @Setup(Level.Iteration) => 0.6 ns @State(Scope.Benchmark) / @Setup(Level.Iteration) => 0.6 ns @State(Scope.Thread) / @Setup(Level.Invocation) => 11 ns @State(Scope.Benchmark) / @Setup(Level.Invocation) => 19 ns

Is this the expected behaviour? Should one simply adjust actual measurements by subtracting those numbers(i.e. is this a fixed and stable overhead)?

Many thanks, Yann



More information about the jmh-dev mailing list