Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Created February 23, 2016 15:01
Show Gist options
  • Save nitsanw/919dca8636e32d448916 to your computer and use it in GitHub Desktop.
Save nitsanw/919dca8636e32d448916 to your computer and use it in GitHub Desktop.
@Benchmark
public void blameSetResult() {
byte b = 0;
for (int i = 0; i < size; i++) {
b += buffer[i];
}
setResult(b); /* LINE 38 */
}
private void setResult(byte b) {
setResult(b == 1); /* LINE 90 */
}
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private void setResult(boolean b) {
result = b;
}
....[Thread state: RUNNABLE]........................................................................
98.6% 98.8% safepoint.profiling.SafepointProfiling.setResult:90
0.2% 0.2% sun.misc.Unsafe.unpark:-2
0.2% 0.2% safepoint.profiling.SafepointProfiling.blameSetResult:38
0.2% 0.2% safepoint.profiling.generated.SafepointProfiling_blameSetResult_jmhTest.blameSetResult_avgt_jmhStub:165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment