spire icon indicating copy to clipboard operation
spire copied to clipboard

Some benchmarks fail due to compiler optimizations in Java 8

Open kaeawc opened this issue 11 years ago • 2 comments

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.

kaeawc avatar Mar 12 '14 16:03 kaeawc

@armanbilge This issue seems outdated too.

i10416 avatar Nov 01 '21 15:11 i10416

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 😅

armanbilge avatar Nov 01 '21 18:11 armanbilge