1) # JMH version: 1.21 2) # VM version: JDK 1.8.0_144, Java HotSpot(TM) 64-Bit Server VM, 25.144-b01 3) # VM invoker: C:\Program Files\Java\jdk1.8.0_144\jre\bin\java.exe 4) # VM options: -javaagent:D:\soft\IntelliJ IDEA 2019.3\lib\idea_rt.jar=61956:D:\soft\IntelliJ IDEA 2019.3\bin -Dfile.encoding=UTF-8 5) # Warmup: 5 iterations, 10 s each 6) # Measurement: 5 iterations, 10 s each 7) # Timeout: 10 min per iteration 8) # Threads: 1 thread, will synchronize iterations 9) # Benchmark mode: Average time, time/op 10) # Benchmark: com.thread.test.JMH.HelloJMH.testStringAdd
23) Result "com.thread.test.JMH.HelloJMH.testStringAdd": a) 445173.784 ±(99.9%) 36450.901 ns/op [Average] b) (min, avg, max) = (432889.165, 445173.784, 456970.538), stdev = 9466.183 c) CI (99.9%): [408722.883, 481624.685] (assumes normal distribution)
24) # JMH version: 1.21 25) # VM version: JDK 1.8.0_144, Java HotSpot(TM) 64-Bit Server VM, 25.144-b01 26) # VM invoker: C:\Program Files\Java\jdk1.8.0_144\jre\bin\java.exe 27) # VM options: -javaagent:D:\soft\IntelliJ IDEA 2019.3\lib\idea_rt.jar=61956:D:\soft\IntelliJ IDEA 2019.3\bin -Dfile.encoding=UTF-8 28) # Warmup: 5 iterations, 10 s each //预热次数 29) # Measurement: 5 iterations, 10 s each //度量次数 30) # Timeout: 10 min per iteration 31) # Threads: 1 thread, will synchronize iterations 32) # Benchmark mode: Average time, time/op 33) # Benchmark: com.thread.test.JMH.HelloJMH.testStringBuilder
46) Result "com.thread.test.JMH.HelloJMH.testStringBuilder": a) 9832.539 ±(99.9%) 963.347 ns/op [Average] b) (min, avg, max) = (9641.269, 9832.539, 10259.971), stdev = 250.178 c) CI (99.9%): [8869.193, 10795.886] (assumes normal distribution)
47) # Run complete. Total time: 00:03:21
48) REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on 49) why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial 50) experiments, perform baseline and negative tests that provide experimental control, make sure 51) the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts. 52) Do not assume the numbers tell you what you want them to tell.