spire
spire copied to clipboard
Some benchmarks fail due to compiler optimizations in Java 8
Caliper attempts to measure how much time a given function takes to process by sending it various sizes of work, but Java 8's new compiler optimizations can remove loops that don't change state and do simple ordered comparisons.
Error: Doing 2x as much work didn't take 2x as much time! Is the JIT optimizing away the body of your benchmark?
To correct this all benchmarks should make sure they change the order of arguments or keep a counter in loops.
@armanbilge This issue seems outdated too.
True, the reference to Caliper is out-dated, but it would be good to confirm that the current JMH benchmarks aren't falling into the same JIT trap before we close this issue.
Thanks, sorry to be very conservative about closing issues 😅