I'm setting up the JMH benchmarks for my application and I'm wondering is there any difference between passing JMH state via benchmark's and accessing it from benchmark body?
In other words
@Benchmark
public int myBenchmark(MyState state) {
MyObject objFromState= state.objFromState;
return objFromState.benchmarkMe();
}
VS
@Benchmark
public int myBenchmark() {
return objFromState.benchmarkMe();
}