Created
July 6, 2013 19:06
Dead code sample sing JHM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GenerateMicroBenchmark | |
public void baseline() { | |
// do nothing, this is a baseline | |
} | |
@GenerateMicroBenchmark | |
public void measureWrong() { | |
// This is wrong: result is not used, and the entire computation is optimized out. | |
Math.log(x); | |
} | |
@GenerateMicroBenchmark | |
public double measureRight() { | |
// This is correct: the result is being used. | |
return Math.log(x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment