Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Created February 23, 2016 15:12
Show Gist options
  • Save nitsanw/549b68bc42f13ea88588 to your computer and use it in GitHub Desktop.
Save nitsanw/549b68bc42f13ea88588 to your computer and use it in GitHub Desktop.
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void blameSetResultDeeper() {
byte b = 0;
for (int i = 0; i < size; i++) {
b += buffer[i];
}
setResult8(b);
}
private void setResult8(byte b) {
setResult7(b);
}
private void setResult7(byte b) {
setResult6(b);
}
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private void setResult6(byte b) {
setResult5(b);
}
private void setResult5(byte b) {
setResult4(b);
}
private void setResult4(byte b) {
setResult3(b);
}
private void setResult3(byte b) {
setResult2(b);
}
private void setResult2(byte b) {
setResult(b); /* Line 86 */
}
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]........................................................................
99.2% 99.4% safepoint.profiling.SafepointProfiling.setResult:90
0.2% 0.2% safepoint.profiling.generated.SafepointProfiling_blameSetResultDeeper_jmhTest.blameSetResultDeeper_avgt_jmhStub:163
0.2% 0.2% sun.misc.Unsafe.compareAndSwapInt:-2
0.2% 0.2% safepoint.profiling.SafepointProfiling.setResult2:86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment