Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Last active May 27, 2016 00:34
Show Gist options
  • Save nitsanw/6ba4d4d6dd8b26c3a8379945268bf0dd to your computer and use it in GitHub Desktop.
Save nitsanw/6ba4d4d6dd8b26c3a8379945268bf0dd to your computer and use it in GitHub Desktop.
@Benchmark
public void copy() {
byte b = 0;
for (int i = 0; i < buffer.length; i++) {
dst[i] = buffer[i];
}
result = dst[buffer.length-1] == 1;
}
# Honest-Profiler reports:
(t 41.6,s 41.6) copy @ (bci=22,line=5)
(t 33.3,s 33.3) copy @ (bci=23,line=4)
(t 9.7,s 9.7) copy @ (bci=21,line=4)
(t 8.5,s 8.5) copy @ (bci=8 ,line=4)
(t 2.3,s 2.3) copy @ (bci=11,line=5)
# JMC reports:
Stack Trace |Samples| Percentage(%)
copy line: 7 bci: 41 | 3,819 | 96.88
copy_avgt_jmhStub line: 165 bci: 27 | 122 | 3.095
# JMC reports with -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints:
Stack Trace |Samples| Percentage(%)
copy line: 5 bci: 22 | 1,662 | 42.204
copy line: 4 bci: 23 | 1,341 | 34.053
copy line: 5 bci: 21 | 381 | 9.675
copy line: 4 bci: 8 | 324 | 8.228
copy line: 5 bci: 11 | 98 | 2.489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment