jponge commented on the post, Micro-Benchmarking with JMH: Measure, Don’t Guess! 2 years, 8 months ago
Although you get measurements that “kind of make sense”, your benchmark code remains subject to constant folding, loop unrolling and dead-code elimination.
To prevent such issues with JMH, you should:
– extract variables to fileds,
– avoid loops, they don’t make any sense here,
– return something from your @Benchmark methods.
See my…[Read more]