# JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.baseline # Run progress: 0.00% complete, ETA 00:02:08 # Fork: 1 of 2 # Warmup Iteration 1: 0.670 ns/op # Warmup Iteration 2: 0.715 ns/op # Warmup Iteration 3: 0.320 ns/op Iteration 1: 0.327 ns/op Iteration 2: 0.320 ns/op Iteration 3: 0.386 ns/op Iteration 4: 0.316 ns/op Iteration 5: 0.320 ns/op # Run progress: 6.25% complete, ETA 00:02:05 # Fork: 2 of 2 # Warmup Iteration 1: 0.732 ns/op # Warmup Iteration 2: 0.719 ns/op # Warmup Iteration 3: 0.509 ns/op Iteration 1: 0.359 ns/op Iteration 2: 0.344 ns/op Iteration 3: 0.403 ns/op Iteration 4: 0.327 ns/op Iteration 5: 0.352 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.baseline": 0.345 ±(99.9%) 0.045 ns/op [Average] (min, avg, max) = (0.316, 0.345, 0.403), stdev = 0.030 CI (99.9%): [0.300, 0.390] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.deadCode # Run progress: 12.50% complete, ETA 00:01:56 # Fork: 1 of 2 # Warmup Iteration 1: 0.849 ns/op # Warmup Iteration 2: 0.664 ns/op # Warmup Iteration 3: 0.330 ns/op Iteration 1: 0.364 ns/op Iteration 2: 0.393 ns/op Iteration 3: 0.318 ns/op Iteration 4: 0.330 ns/op Iteration 5: 0.392 ns/op # Run progress: 18.75% complete, ETA 00:01:48 # Fork: 2 of 2 # Warmup Iteration 1: 0.719 ns/op # Warmup Iteration 2: 0.703 ns/op # Warmup Iteration 3: 0.366 ns/op Iteration 1: 0.364 ns/op Iteration 2: 0.371 ns/op Iteration 3: 0.334 ns/op Iteration 4: 0.367 ns/op Iteration 5: 0.409 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.deadCode": 0.364 ±(99.9%) 0.045 ns/op [Average] (min, avg, max) = (0.318, 0.364, 0.409), stdev = 0.030 CI (99.9%): [0.320, 0.409] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.logOfConstant # Run progress: 25.00% complete, ETA 00:01:39 # Fork: 1 of 2 # Warmup Iteration 1: 8.047 ns/op # Warmup Iteration 2: 7.451 ns/op # Warmup Iteration 3: 6.837 ns/op Iteration 1: 6.602 ns/op Iteration 2: 6.579 ns/op Iteration 3: 7.626 ns/op Iteration 4: 6.919 ns/op Iteration 5: 7.168 ns/op # Run progress: 31.25% complete, ETA 00:01:31 # Fork: 2 of 2 # Warmup Iteration 1: 7.435 ns/op # Warmup Iteration 2: 7.437 ns/op # Warmup Iteration 3: 6.543 ns/op Iteration 1: 6.941 ns/op Iteration 2: 6.895 ns/op Iteration 3: 6.854 ns/op Iteration 4: 8.124 ns/op Iteration 5: 6.648 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.logOfConstant": 7.036 ±(99.9%) 0.743 ns/op [Average] (min, avg, max) = (6.579, 7.036, 8.124), stdev = 0.491 CI (99.9%): [6.293, 7.779] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.powOfConstant # Run progress: 37.50% complete, ETA 00:01:22 # Fork: 1 of 2 # Warmup Iteration 1: 0.345 ns/op # Warmup Iteration 2: 0.408 ns/op # Warmup Iteration 3: 0.432 ns/op Iteration 1: 0.346 ns/op Iteration 2: 0.341 ns/op Iteration 3: 0.333 ns/op Iteration 4: 0.481 ns/op Iteration 5: 0.561 ns/op # Run progress: 43.75% complete, ETA 00:01:14 # Fork: 2 of 2 # Warmup Iteration 1: 0.359 ns/op # Warmup Iteration 2: 0.425 ns/op # Warmup Iteration 3: 0.340 ns/op Iteration 1: 0.428 ns/op Iteration 2: 0.349 ns/op Iteration 3: 0.497 ns/op Iteration 4: 0.576 ns/op Iteration 5: 0.494 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.powOfConstant": 0.441 ±(99.9%) 0.142 ns/op [Average] (min, avg, max) = (0.333, 0.441, 0.576), stdev = 0.094 CI (99.9%): [0.298, 0.583] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.powOfField # Run progress: 50.00% complete, ETA 00:01:06 # Fork: 1 of 2 # Warmup Iteration 1: 14.437 ns/op # Warmup Iteration 2: 15.012 ns/op # Warmup Iteration 3: 13.839 ns/op Iteration 1: 14.298 ns/op Iteration 2: 14.261 ns/op Iteration 3: 13.866 ns/op Iteration 4: 14.114 ns/op Iteration 5: 13.812 ns/op # Run progress: 56.25% complete, ETA 00:00:57 # Fork: 2 of 2 # Warmup Iteration 1: 14.805 ns/op # Warmup Iteration 2: 15.195 ns/op # Warmup Iteration 3: 13.683 ns/op Iteration 1: 13.712 ns/op Iteration 2: 15.469 ns/op Iteration 3: 16.961 ns/op Iteration 4: 13.916 ns/op Iteration 5: 14.715 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.powOfField": 14.512 ±(99.9%) 1.522 ns/op [Average] (min, avg, max) = (13.712, 14.512, 16.961), stdev = 1.007 CI (99.9%): [12.990, 16.035] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.powOfFinalField # Run progress: 62.50% complete, ETA 00:00:49 # Fork: 1 of 2 # Warmup Iteration 1: 0.396 ns/op # Warmup Iteration 2: 0.385 ns/op # Warmup Iteration 3: 0.325 ns/op Iteration 1: 0.603 ns/op Iteration 2: 0.332 ns/op Iteration 3: 0.327 ns/op Iteration 4: 0.333 ns/op Iteration 5: 0.359 ns/op # Run progress: 68.75% complete, ETA 00:00:41 # Fork: 2 of 2 # Warmup Iteration 1: 0.419 ns/op # Warmup Iteration 2: 0.366 ns/op # Warmup Iteration 3: 0.342 ns/op Iteration 1: 0.344 ns/op Iteration 2: 0.338 ns/op Iteration 3: 0.344 ns/op Iteration 4: 0.352 ns/op Iteration 5: 0.343 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.powOfFinalField": 0.367 ±(99.9%) 0.126 ns/op [Average] (min, avg, max) = (0.327, 0.367, 0.603), stdev = 0.083 CI (99.9%): [0.242, 0.493] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.returned # Run progress: 75.00% complete, ETA 00:00:33 # Fork: 1 of 2 # Warmup Iteration 1: 8.614 ns/op # Warmup Iteration 2: 7.575 ns/op # Warmup Iteration 3: 7.764 ns/op Iteration 1: 7.586 ns/op Iteration 2: 9.793 ns/op Iteration 3: 8.194 ns/op Iteration 4: 6.814 ns/op Iteration 5: 6.702 ns/op # Run progress: 81.25% complete, ETA 00:00:24 # Fork: 2 of 2 # Warmup Iteration 1: 7.652 ns/op # Warmup Iteration 2: 6.920 ns/op # Warmup Iteration 3: 7.625 ns/op Iteration 1: 7.713 ns/op Iteration 2: 6.881 ns/op Iteration 3: 8.208 ns/op Iteration 4: 6.475 ns/op Iteration 5: 8.223 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.returned": 7.659 ±(99.9%) 1.521 ns/op [Average] (min, avg, max) = (6.475, 7.659, 9.793), stdev = 1.006 CI (99.9%): [6.138, 9.180] (assumes normal distribution) # JMH version: 1.37 # VM version: JDK 25.0.5, OpenJDK 64-Bit Server VM, 25.0.5+8-LTS # VM invoker: /tmp/tools/jdk-25.0.5+8/bin/java # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 3 iterations, 1 s each # Measurement: 5 iterations, 1 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op # Benchmark: com.ankurm.jmhbasics.DeadCodeBenchmark.viaBlackhole # Run progress: 87.50% complete, ETA 00:00:16 # Fork: 1 of 2 # Warmup Iteration 1: 8.460 ns/op # Warmup Iteration 2: 6.864 ns/op # Warmup Iteration 3: 7.808 ns/op Iteration 1: 8.439 ns/op Iteration 2: 10.136 ns/op Iteration 3: 9.039 ns/op Iteration 4: 8.146 ns/op Iteration 5: 7.843 ns/op # Run progress: 93.75% complete, ETA 00:00:08 # Fork: 2 of 2 # Warmup Iteration 1: 6.960 ns/op # Warmup Iteration 2: 7.100 ns/op # Warmup Iteration 3: 7.036 ns/op Iteration 1: 9.381 ns/op Iteration 2: 7.383 ns/op Iteration 3: 6.564 ns/op Iteration 4: 6.919 ns/op Iteration 5: 7.026 ns/op Result "com.ankurm.jmhbasics.DeadCodeBenchmark.viaBlackhole": 8.088 ±(99.9%) 1.766 ns/op [Average] (min, avg, max) = (6.564, 8.088, 10.136), stdev = 1.168 CI (99.9%): [6.322, 9.853] (assumes normal distribution) # Run complete. Total time: 00:02:12 REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial experiments, perform baseline and negative tests that provide experimental control, make sure the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts. Do not assume the numbers tell you what you want them to tell. NOTE: Current JVM experimentally supports Compiler Blackholes, and they are in use. Please exercise extra caution when trusting the results, look into the generated code to check the benchmark still works, and factor in a small probability of new VM bugs. Additionally, while comparisons between different JVMs are already problematic, the performance difference caused by different Blackhole modes can be very significant. Please make sure you use the consistent Blackhole mode for comparisons. Benchmark Mode Cnt Score Error Units DeadCodeBenchmark.baseline avgt 10 0.345 ± 0.045 ns/op DeadCodeBenchmark.deadCode avgt 10 0.364 ± 0.045 ns/op DeadCodeBenchmark.logOfConstant avgt 10 7.036 ± 0.743 ns/op DeadCodeBenchmark.powOfConstant avgt 10 0.441 ± 0.142 ns/op DeadCodeBenchmark.powOfField avgt 10 14.512 ± 1.522 ns/op DeadCodeBenchmark.powOfFinalField avgt 10 0.367 ± 0.126 ns/op DeadCodeBenchmark.returned avgt 10 7.659 ± 1.521 ns/op DeadCodeBenchmark.viaBlackhole avgt 10 8.088 ± 1.766 ns/op