jponge commented on the post, Micro-Benchmarking with JMH: Measure, Don’t Guess! 3 years, 1 month 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]