이것은 내 첫 JMH 벤치 마크입니다. 나는JMH는 아무 일도하지 않을 때 무엇을합니까?
내 벤치 마크는 내가 그것을 시작 ... 그리고 기다리고 기다린 후 사망이
@State(Scope.Benchmark) public class JmhBranchingBenchmark {
private static final int STRING_LENGTH = 100 * 1000;
private char[][] allQueries = new char[101][];
@Setup public void up() {
for (int i=0; i<allQueries.length; ++i) {
... fill char[i] with STRING_LENGTH chars
... this might take some time, but it's needed only once, or?
}
}
@GenerateMicroBenchmark public void measure5(BlackHole bh) {
bh.consume(countBreakingWhitespace(allQueries[5]));
}
... some more nearly identical methods as a poor man's replacement for caliper's @Param
}
같습니다 .... 모든 잘못하고 있지만, 될 수 있습니다. 나는 @Setup
에있는 문제를 의심했기 때문에 단순화했지만 아무 것도 변경되지 않았습니다. 달리기는 꽤 낙관적입니다 ...
time -p java -jar target/microbenchmarks.jar ".*JmhBranchingBenchmark.*" -i 5 -f 1
# Run progress: 0.00% complete, ETA 00:02:05
# VM invoker: /usr/lib/jvm/java-7-oracle/jre/bin/java
# VM options: <none>
# Fork: 1 of 1
# Warmup: 20 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: org.openjdk.jmh.samples.JmhBranchingBenchmark.measure10
# Warmup Iteration 1:
그리고 나서 아무 일도 일어나지 않습니다. 오랜 시간 후에, 그 다음 어떤 결과
Result : 6.510 ±(99.9%) 0.030 ops/ms
Statistics: (min, avg, max) = (6.502, 6.510, 6.521), stdev = 0.008
Confidence interval (99.9%): [6.480, 6.540]
출력과 예상 도착 시간을 보정 계속
# Warmup Iteration 1: 6.415 ops/ms
추천 라인
Iteration 1: 6.506 ops/ms
추천 라인 해주기
# Run progress: 20.00% complete, ETA 00:26:52
내 01 않습니다은 내가 생각하는 것보다 훨씬 더 자주 호출됩니다. 아니면 느려지는 이유는 무엇입니까?
네 말이 맞아. 여기에서 물어보기 전에 다시 확인했지만이 두 번 확인으로는 충분하지 않았습니다. ;) – maaartinus