Skip to content

Instantly share code, notes, and snippets.

@nitsanw
Last active May 26, 2016 13:53
Show Gist options
  • Save nitsanw/2518888fa21ec6a891490c072b30c082 to your computer and use it in GitHub Desktop.
Save nitsanw/2518888fa21ec6a891490c072b30c082 to your computer and use it in GitHub Desktop.
public class SafepointProfiling {
@Param("1000")
int size;
byte[] buffer;
byte[] dst;
boolean result;
@Setup
public final void setup() {
buffer = new byte[size];
dst = new byte[size];
}
@Benchmark
public void meSoHotInline() {
byte b = 0;
for (int i = 0; i < size; i++) {
b += buffer[i];
}
result = b == 1;
}
# Benchmark: safepoint.profiling.SafepointProfiling.meSoHotInline
JMH Stack profiler:
99.6% 99.8% meSoHotInline_avgt_jmhStub:165
Honest Profiler:
(t 98.7,s 98.7) meSoHotInline @ (bci=12,line=18)
(t 0.8,s 0.8) meSoHotInline_avgt_jmhStub @ (bci=27,line=165)
@Benchmark
@CompilerControl(CompilerControl.Mode.DONT_INLINE)
public void meSoHotNoInline() {
byte b = 0;
for (int i = 0; i < size; i++) {
b += buffer[i];
}
result = b == 1;
}
# Benchmark: safepoint.profiling.SafepointProfiling.meSoHotNoInline
JMH Stack profiler:
99.4% 99.6% meSoHotNoInline_avgt_jmhStub:163
Honest Profiler:
(t 98.9,s 98.9) meSoHotNoInline @ (bci=12,line=36)
(t 0.4,s 0.4) AGCT::Unknown not Java[ERR=-3] @ (bci=-1,line=-100)
(t 0.2,s 0.2) AGCT::Unknown Java[ERR=-5] @ (bci=-1,line=-100)
(t 0.1,s 0.1) meSoHotNoInline_avgt_jmhStub @ (bci=27,line=165)
(t 99.0,s 0.1) meSoHotNoInline_avgt_jmhStub @ (bci=14,line=163)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment