Skip to content

Instantly share code, notes, and snippets.

@wololock
Last active June 25, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wololock/6e3c52785c412ef19444ecc549489110 to your computer and use it in GitHub Desktop.
Save wololock/6e3c52785c412ef19444ecc549489110 to your computer and use it in GitHub Desktop.
Groovy Trampoline Closure benchmark results (Groovy 2.5.7)
$ ./gradlew clean jmh --no-daemon
> Task :jmhRunBytecodeGenerator
Processing 0 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/java/jmh with "reflection" generator
Processing 5 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/groovy/jmh with "reflection" generator
Writing out Java source to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-sources and resources to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-resources
# Warmup Iteration 1: UTING [6s]
> Task :jmh
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.a_standard
# Run progress: 0,00% complete, ETA 00:07:12
# Fork: 1 of 1
477,967 ms/op
Iteration 1: 474,164 ms/op
·stack: <delayed till summary>
Iteration 2: 473,772 ms/op
·stack: <delayed till summary>
Iteration 3: 474,610 ms/op
·stack: <delayed till summary>
Iteration 4: 471,522 ms/op
·stack: <delayed till summary>
Iteration 5: 471,769 ms/op
·stack: <delayed till summary>
Iteration 6: 473,352 ms/op
·stack: <delayed till summary>
Iteration 7: 473,042 ms/op
·stack: <delayed till summary>
Iteration 8: 470,094 ms/op
·stack: <delayed till summary>
Iteration 9: 471,965 ms/op
·stack: <delayed till summary>
Iteration 10: 474,056 ms/op
·stack: <delayed till summary>
Iteration 11: 472,054 ms/op
·stack: <delayed till summary>
Iteration 12: 470,456 ms/op
·stack: <delayed till summary>
Iteration 13: 469,829 ms/op
·stack: <delayed till summary>
Iteration 14: 471,235 ms/op
·stack: <delayed till summary>
Iteration 15: 473,384 ms/op
·stack: <delayed till summary>
Iteration 16: 464,013 ms/op
·stack: <delayed till summary>
Iteration 17: 475,380 ms/op
·stack: <delayed till summary>
Iteration 18: 469,934 ms/op
·stack: <delayed till summary>
Iteration 19: 473,955 ms/op
·stack: <delayed till summary>
Iteration 20: 475,309 ms/op
·stack: <delayed till summary>
Iteration 21: 472,378 ms/op
·stack: <delayed till summary>
Iteration 22: 469,554 ms/op
·stack: <delayed till summary>
Iteration 23: 468,405 ms/op
·stack: <delayed till summary>
Iteration 24: 470,421 ms/op
·stack: <delayed till summary>
Iteration 25: 473,600 ms/op
·stack: <delayed till summary>
Iteration 26: 470,049 ms/op
·stack: <delayed till summary>
Iteration 27: 469,054 ms/op
·stack: <delayed till summary>
Iteration 28: 474,099 ms/op
·stack: <delayed till summary>
Iteration 29: 474,732 ms/op
·stack: <delayed till summary>
Iteration 30: 470,705 ms/op
·stack: <delayed till summary>
Iteration 31: 472,245 ms/op
·stack: <delayed till summary>
Iteration 32: 473,955 ms/op
·stack: <delayed till summary>
Iteration 33: 472,949 ms/op
·stack: <delayed till summary>
Iteration 34: 475,879 ms/op
·stack: <delayed till summary>
Iteration 35: 471,879 ms/op
·stack: <delayed till summary>
Iteration 36: 475,069 ms/op
·stack: <delayed till summary>
Iteration 37: 469,583 ms/op
·stack: <delayed till summary>
Iteration 38: 470,813 ms/op
·stack: <delayed till summary>
Iteration 39: 471,214 ms/op
·stack: <delayed till summary>
Iteration 40: 470,137 ms/op
·stack: <delayed till summary>
Iteration 41: 476,163 ms/op
·stack: <delayed till summary>
Iteration 42: 471,993 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.a_standard":
472,114 ±(99.9%) 1,315 ms/op [Average]
(min, avg, max) = (464,013, 472,114, 476,163), stdev = 2,405
CI (99.9%): [470,799, 473,429] (assumes normal distribution)
Secondary result "bench.FactorialBench.a_standard:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
43,6% 43,6% org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.pickClosureMethod
21,6% 21,6% sun.reflect.DelegatingMethodAccessorImpl.invoke
21,2% 21,2% org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke
5,5% 5,6% groovy.lang.MetaMethod.doMethodInvoke
3,6% 3,6% groovy.lang.MetaClassImpl.invokeMethod
3,1% 3,1% sun.reflect.GeneratedMethodAccessor2.invoke
0,4% 0,4% java.math.BigInteger.multiply
0,3% 0,3% org.codehaus.groovy.runtime.ArrayUtil.createArray
0,2% 0,2% java.util.Arrays.copyOf
0,2% 0,2% java.util.Arrays.copyOfRange
0,4% 0,4% <other>
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.a_standard_sc
# Run progress: 16,67% complete, ETA 00:07:31
# Fork: 1 of 1
# Warmup Iteration 1: 373,646 ms/op
Iteration 1: 429,619 ms/opG [2m 7s]
·stack: <delayed till summary>
Iteration 2: 428,290 ms/op
·stack: <delayed till summary>
Iteration 3: 433,396 ms/op
·stack: <delayed till summary>
Iteration 4: 426,265 ms/op
·stack: <delayed till summary>
Iteration 5: 432,005 ms/op
·stack: <delayed till summary>
Iteration 6: 429,904 ms/op
·stack: <delayed till summary>
Iteration 7: 429,748 ms/op
·stack: <delayed till summary>
Iteration 8: 427,878 ms/op
·stack: <delayed till summary>
Iteration 9: 429,801 ms/op
·stack: <delayed till summary>
Iteration 10: 428,300 ms/op
·stack: <delayed till summary>
Iteration 11: 427,873 ms/op
·stack: <delayed till summary>
Iteration 12: 428,478 ms/op
·stack: <delayed till summary>
Iteration 13: 430,786 ms/op
·stack: <delayed till summary>
Iteration 14: 430,263 ms/op
·stack: <delayed till summary>
Iteration 15: 432,777 ms/op
·stack: <delayed till summary>
Iteration 16: 431,199 ms/op
·stack: <delayed till summary>
Iteration 17: 429,672 ms/op
·stack: <delayed till summary>
Iteration 18: 427,533 ms/op
·stack: <delayed till summary>
Iteration 19: 427,674 ms/op
·stack: <delayed till summary>
Iteration 20: 428,452 ms/op
·stack: <delayed till summary>
Iteration 21: 427,282 ms/op
·stack: <delayed till summary>
Iteration 22: 426,116 ms/op
·stack: <delayed till summary>
Iteration 23: 427,925 ms/op
·stack: <delayed till summary>
Iteration 24: 431,012 ms/op
·stack: <delayed till summary>
Iteration 25: 426,264 ms/op
·stack: <delayed till summary>
Iteration 26: 429,045 ms/op
·stack: <delayed till summary>
Iteration 27: 426,961 ms/op
·stack: <delayed till summary>
Iteration 28: 430,228 ms/op
·stack: <delayed till summary>
Iteration 29: 425,993 ms/op
·stack: <delayed till summary>
Iteration 30: 426,260 ms/op
·stack: <delayed till summary>
Iteration 31: 425,928 ms/op
·stack: <delayed till summary>
Iteration 32: 427,342 ms/op
·stack: <delayed till summary>
Iteration 33: 424,943 ms/op
·stack: <delayed till summary>
Iteration 34: 426,973 ms/op
·stack: <delayed till summary>
Iteration 35: 431,287 ms/op
·stack: <delayed till summary>
Iteration 36: 429,794 ms/op
·stack: <delayed till summary>
Iteration 37: 428,183 ms/op
·stack: <delayed till summary>
Iteration 38: 428,219 ms/op
·stack: <delayed till summary>
Iteration 39: 429,747 ms/op
·stack: <delayed till summary>
Iteration 40: 428,287 ms/op
·stack: <delayed till summary>
Iteration 41: 428,738 ms/op
·stack: <delayed till summary>
Iteration 42: 429,666 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.a_standard_sc":
428,717 ±(99.9%) 1,063 ms/op [Average]
(min, avg, max) = (424,943, 428,717, 433,396), stdev = 1,943
CI (99.9%): [427,654, 429,780] (assumes normal distribution)
Secondary result "bench.FactorialBench.a_standard_sc:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
39,4% 39,4% java.math.BigInteger.multiply
31,4% 31,4% org.codehaus.groovy.runtime.metaclass.ClosureMetaClass$NormalMethodChooser.chooseMethod
14,9% 14,9% org.codehaus.groovy.reflection.ParameterTypes.correctArguments
4,3% 4,3% groovy.lang.MetaClassImpl.invokeMethod
4,1% 4,1% sun.reflect.GeneratedMethodAccessor1.invoke
3,7% 3,7% org.codehaus.groovy.reflection.CachedMethod.invoke
0,4% 0,4% bench.FactorialBench$_a_standard_sc_closure2.doCall
0,4% 0,4% java.util.Arrays.copyOf
0,3% 0,3% bench.FactorialBench.a_standard_sc
0,2% 0,2% java.math.BigInteger.multiplyByInt
0,9% 0,9% <other>
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.b_trampoline
# Run progress: 33,33% complete, ETA 00:05:50
# Fork: 1 of 1
# Warmup Iteration 1: 1079,646 ms/op
Iteration 1: 1056,559 ms/op [3m 32s]
·stack: <delayed till summary>
Iteration 2: 1072,110 ms/op
·stack: <delayed till summary>
Iteration 3: 1052,291 ms/op
·stack: <delayed till summary>
Iteration 4: 1058,594 ms/op
·stack: <delayed till summary>
Iteration 5: 1052,906 ms/op
·stack: <delayed till summary>
Iteration 6: 1056,373 ms/op
·stack: <delayed till summary>
Iteration 7: 1057,837 ms/op
·stack: <delayed till summary>
Iteration 8: 1053,111 ms/op
·stack: <delayed till summary>
Iteration 9: 1063,369 ms/op
·stack: <delayed till summary>
Iteration 10: 1056,966 ms/op
·stack: <delayed till summary>
Iteration 11: 1054,286 ms/op
·stack: <delayed till summary>
Iteration 12: 1054,272 ms/op
·stack: <delayed till summary>
Iteration 13: 1053,657 ms/op
·stack: <delayed till summary>
Iteration 14: 1052,634 ms/op
·stack: <delayed till summary>
Iteration 15: 1068,402 ms/op
·stack: <delayed till summary>
Iteration 16: 1049,847 ms/op
·stack: <delayed till summary>
Iteration 17: 1052,860 ms/op
·stack: <delayed till summary>
Iteration 18: 1045,599 ms/op
·stack: <delayed till summary>
Iteration 19: 1072,224 ms/op
·stack: <delayed till summary>
Iteration 20: 1052,248 ms/op
·stack: <delayed till summary>
Iteration 21: 1058,598 ms/op
·stack: <delayed till summary>
Iteration 22: 1056,083 ms/op
·stack: <delayed till summary>
Iteration 23: 1050,190 ms/op
·stack: <delayed till summary>
Iteration 24: 1055,833 ms/op
·stack: <delayed till summary>
Iteration 25: 1056,708 ms/op
·stack: <delayed till summary>
Iteration 26: 1049,773 ms/op
·stack: <delayed till summary>
Iteration 27: 1049,239 ms/op
·stack: <delayed till summary>
Iteration 28: 1056,065 ms/op
·stack: <delayed till summary>
Iteration 29: 1042,390 ms/op
·stack: <delayed till summary>
Iteration 30: 1057,428 ms/op
·stack: <delayed till summary>
Iteration 31: 1059,589 ms/op
·stack: <delayed till summary>
Iteration 32: 1057,875 ms/op
·stack: <delayed till summary>
Iteration 33: 1040,140 ms/op
·stack: <delayed till summary>
Iteration 34: 1048,196 ms/op
·stack: <delayed till summary>
Iteration 35: 1046,953 ms/op
·stack: <delayed till summary>
Iteration 36: 1060,372 ms/op
·stack: <delayed till summary>
Iteration 37: 1056,539 ms/op
·stack: <delayed till summary>
Iteration 38: 1054,780 ms/op
·stack: <delayed till summary>
Iteration 39: 1040,623 ms/op
·stack: <delayed till summary>
Iteration 40: 1046,722 ms/op
·stack: <delayed till summary>
Iteration 41: 1056,686 ms/op
·stack: <delayed till summary>
Iteration 42: 1060,596 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.b_trampoline":
1054,703 ±(99.9%) 3,805 ms/op [Average]
(min, avg, max) = (1040,140, 1054,703, 1072,224), stdev = 6,957
CI (99.9%): [1050,898, 1058,508] (assumes normal distribution)
Secondary result "bench.FactorialBench.b_trampoline:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
22,6% 22,6% org.codehaus.groovy.reflection.ParameterTypes.isValidMethod
21,8% 21,8% org.codehaus.groovy.reflection.ParameterTypes.coerceArgumentsToClasses
15,5% 15,5% org.codehaus.groovy.reflection.ParameterTypes.correctArguments
11,5% 11,5% groovy.lang.Closure.<init>
9,4% 9,4% sun.reflect.DelegatingMethodAccessorImpl.invoke
8,5% 8,5% groovy.lang.TrampolineClosure.<init>
7,1% 7,1% org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.pickClosureMethod
0,4% 0,4% groovy.lang.MetaClassImpl.invokeMethod
0,3% 0,3% org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke
0,3% 0,3% java.math.BigInteger.multiply
2,6% 2,6% <other>
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.b_trampoline_sc
# Run progress: 50,00% complete, ETA 00:04:10
# Fork: 1 of 1
# Warmup Iteration 1: 701,601 ms/op
Iteration 1: 682,376 ms/opG [4m 47s]
·stack: <delayed till summary>
Iteration 2: 681,532 ms/op
·stack: <delayed till summary>
Iteration 3: 683,844 ms/op
·stack: <delayed till summary>
Iteration 4: 694,822 ms/op
·stack: <delayed till summary>
Iteration 5: 682,867 ms/op
·stack: <delayed till summary>
Iteration 6: 682,532 ms/op
·stack: <delayed till summary>
Iteration 7: 686,558 ms/op
·stack: <delayed till summary>
Iteration 8: 680,990 ms/op
·stack: <delayed till summary>
Iteration 9: 678,152 ms/op
·stack: <delayed till summary>
Iteration 10: 685,365 ms/op
·stack: <delayed till summary>
Iteration 11: 681,635 ms/op
·stack: <delayed till summary>
Iteration 12: 689,410 ms/op
·stack: <delayed till summary>
Iteration 13: 687,541 ms/op
·stack: <delayed till summary>
Iteration 14: 686,734 ms/op
·stack: <delayed till summary>
Iteration 15: 681,979 ms/op
·stack: <delayed till summary>
Iteration 16: 683,491 ms/op
·stack: <delayed till summary>
Iteration 17: 675,367 ms/op
·stack: <delayed till summary>
Iteration 18: 680,768 ms/op
·stack: <delayed till summary>
Iteration 19: 691,508 ms/op
·stack: <delayed till summary>
Iteration 20: 678,849 ms/op
·stack: <delayed till summary>
Iteration 21: 674,466 ms/op
·stack: <delayed till summary>
Iteration 22: 683,549 ms/op
·stack: <delayed till summary>
Iteration 23: 680,300 ms/op
·stack: <delayed till summary>
Iteration 24: 683,936 ms/op
·stack: <delayed till summary>
Iteration 25: 685,476 ms/op
·stack: <delayed till summary>
Iteration 26: 677,886 ms/op
·stack: <delayed till summary>
Iteration 27: 682,382 ms/op
·stack: <delayed till summary>
Iteration 28: 682,774 ms/op
·stack: <delayed till summary>
Iteration 29: 684,362 ms/op
·stack: <delayed till summary>
Iteration 30: 681,784 ms/op
·stack: <delayed till summary>
Iteration 31: 683,386 ms/op
·stack: <delayed till summary>
Iteration 32: 683,137 ms/op
·stack: <delayed till summary>
Iteration 33: 687,890 ms/op
·stack: <delayed till summary>
Iteration 34: 681,044 ms/op
·stack: <delayed till summary>
Iteration 35: 685,049 ms/op
·stack: <delayed till summary>
Iteration 36: 679,910 ms/op
·stack: <delayed till summary>
Iteration 37: 688,328 ms/op
·stack: <delayed till summary>
Iteration 38: 684,081 ms/op
·stack: <delayed till summary>
Iteration 39: 681,452 ms/op
·stack: <delayed till summary>
Iteration 40: 686,040 ms/op
·stack: <delayed till summary>
Iteration 41: 686,871 ms/op
·stack: <delayed till summary>
Iteration 42: 677,892 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.b_trampoline_sc":
683,293 ±(99.9%) 2,191 ms/op [Average]
(min, avg, max) = (674,466, 683,293, 694,822), stdev = 4,007
CI (99.9%): [681,102, 685,485] (assumes normal distribution)
Secondary result "bench.FactorialBench.b_trampoline_sc:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
29,2% 29,2% org.codehaus.groovy.reflection.ParameterTypes.isValidMethod
24,5% 24,5% java.math.BigInteger.multiply
16,7% 16,7% groovy.lang.Closure.<init>
10,4% 10,4% groovy.lang.TrampolineClosure.<init>
9,8% 9,8% org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.pickClosureMethod
4,0% 4,0% org.codehaus.groovy.runtime.metaclass.MetaMethodIndex.getMethods
2,4% 2,4% org.codehaus.groovy.reflection.ParameterTypes.correctArguments
0,7% 0,7% sun.reflect.GeneratedMethodAccessor1.invoke
0,5% 0,5% groovy.lang.MetaClassImpl.invokeMethod
0,3% 0,3% java.util.Arrays.copyOf
1,3% 1,3% <other>
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.c_tailRecursive
# Run progress: 66,67% complete, ETA 00:02:49
# Fork: 1 of 1
# Warmup Iteration 1: 325,024 ms/op
Iteration 1: 322,669 ms/opG [6m 15s]
·stack: <delayed till summary>
Iteration 2: 319,018 ms/op
·stack: <delayed till summary>
Iteration 3: 319,218 ms/op
·stack: <delayed till summary>
Iteration 4: 319,027 ms/op
·stack: <delayed till summary>
Iteration 5: 320,541 ms/op
·stack: <delayed till summary>
Iteration 6: 321,659 ms/op
·stack: <delayed till summary>
Iteration 7: 321,985 ms/op
·stack: <delayed till summary>
Iteration 8: 324,728 ms/op
·stack: <delayed till summary>
Iteration 9: 322,951 ms/op
·stack: <delayed till summary>
Iteration 10: 319,770 ms/op
·stack: <delayed till summary>
Iteration 11: 322,773 ms/op
·stack: <delayed till summary>
Iteration 12: 322,799 ms/op
·stack: <delayed till summary>
Iteration 13: 320,689 ms/op
·stack: <delayed till summary>
Iteration 14: 319,926 ms/op
·stack: <delayed till summary>
Iteration 15: 323,382 ms/op
·stack: <delayed till summary>
Iteration 16: 321,706 ms/op
·stack: <delayed till summary>
Iteration 17: 319,675 ms/op
·stack: <delayed till summary>
Iteration 18: 333,903 ms/op
·stack: <delayed till summary>
Iteration 19: 325,925 ms/op
·stack: <delayed till summary>
Iteration 20: 323,058 ms/op
·stack: <delayed till summary>
Iteration 21: 320,974 ms/op
·stack: <delayed till summary>
Iteration 22: 322,825 ms/op
·stack: <delayed till summary>
Iteration 23: 322,935 ms/op
·stack: <delayed till summary>
Iteration 24: 322,760 ms/op
·stack: <delayed till summary>
Iteration 25: 322,561 ms/op
·stack: <delayed till summary>
Iteration 26: 325,462 ms/op
·stack: <delayed till summary>
Iteration 27: 318,686 ms/op
·stack: <delayed till summary>
Iteration 28: 322,617 ms/op
·stack: <delayed till summary>
Iteration 29: 321,540 ms/op
·stack: <delayed till summary>
Iteration 30: 319,115 ms/op
·stack: <delayed till summary>
Iteration 31: 322,472 ms/op
·stack: <delayed till summary>
Iteration 32: 322,578 ms/op
·stack: <delayed till summary>
Iteration 33: 320,371 ms/op
·stack: <delayed till summary>
Iteration 34: 319,494 ms/op
·stack: <delayed till summary>
Iteration 35: 321,526 ms/op
·stack: <delayed till summary>
Iteration 36: 321,996 ms/op
·stack: <delayed till summary>
Iteration 37: 320,741 ms/op
·stack: <delayed till summary>
Iteration 38: 321,131 ms/op
·stack: <delayed till summary>
Iteration 39: 320,885 ms/op
·stack: <delayed till summary>
Iteration 40: 324,604 ms/op
·stack: <delayed till summary>
Iteration 41: 321,016 ms/op
·stack: <delayed till summary>
Iteration 42: 323,118 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.c_tailRecursive":
322,019 ±(99.9%) 1,409 ms/op [Average]
(min, avg, max) = (318,686, 322,019, 333,903), stdev = 2,576
CI (99.9%): [320,611, 323,428] (assumes normal distribution)
Secondary result "bench.FactorialBench.c_tailRecursive:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
41,5% 41,5% java.math.BigInteger.<init>
26,8% 26,8% java.math.BigInteger.multiply
15,9% 15,9% java.lang.Integer.getChars
14,2% 14,2% java.lang.Integer.stringSize
0,5% 0,5% java.math.BigInteger.multiplyByInt
0,3% 0,3% bench.FactorialBench.factorialTailRecursive
0,2% 0,2% java.lang.Integer.toString
0,2% 0,2% org.codehaus.groovy.runtime.typehandling.NumberMath.toBigInteger
0,2% 0,2% java.util.Arrays.copyOfRange
0,0% 0,0% org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
# VM invoker: /home/wololock/.sdkman/candidates/java/8.0.201-oracle/jre/bin/java
# VM options: <none>
# Warmup: 1 iterations, 30 s each
# Measurement: 42 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: bench.FactorialBench.c_tailRecursive_sc
# Run progress: 83,33% complete, ETA 00:01:24
# Fork: 1 of 1
# Warmup Iteration 1: 104,881 ms/op
Iteration 1: 103,844 ms/opG [7m 40s]
·stack: <delayed till summary>
Iteration 2: 103,572 ms/op
·stack: <delayed till summary>
Iteration 3: 103,271 ms/op
·stack: <delayed till summary>
Iteration 4: 102,808 ms/op
·stack: <delayed till summary>
Iteration 5: 106,644 ms/op
·stack: <delayed till summary>
Iteration 6: 106,179 ms/op
·stack: <delayed till summary>
Iteration 7: 104,757 ms/op
·stack: <delayed till summary>
Iteration 8: 113,281 ms/op
·stack: <delayed till summary>
Iteration 9: 110,179 ms/op
·stack: <delayed till summary>
Iteration 10: 104,833 ms/op
·stack: <delayed till summary>
Iteration 11: 106,265 ms/op
·stack: <delayed till summary>
Iteration 12: 102,393 ms/op
·stack: <delayed till summary>
Iteration 13: 104,745 ms/op
·stack: <delayed till summary>
Iteration 14: 104,348 ms/op
·stack: <delayed till summary>
Iteration 15: 112,866 ms/op
·stack: <delayed till summary>
Iteration 16: 107,593 ms/op
·stack: <delayed till summary>
Iteration 17: 103,813 ms/op
·stack: <delayed till summary>
Iteration 18: 104,507 ms/op
·stack: <delayed till summary>
Iteration 19: 103,315 ms/op
·stack: <delayed till summary>
Iteration 20: 102,808 ms/op
·stack: <delayed till summary>
Iteration 21: 103,908 ms/op
·stack: <delayed till summary>
Iteration 22: 104,244 ms/op
·stack: <delayed till summary>
Iteration 23: 101,158 ms/op
·stack: <delayed till summary>
Iteration 24: 102,877 ms/op
·stack: <delayed till summary>
Iteration 25: 103,506 ms/op
·stack: <delayed till summary>
Iteration 26: 103,610 ms/op
·stack: <delayed till summary>
Iteration 27: 103,192 ms/op
·stack: <delayed till summary>
Iteration 28: 103,945 ms/op
·stack: <delayed till summary>
Iteration 29: 103,478 ms/op
·stack: <delayed till summary>
Iteration 30: 102,608 ms/op
·stack: <delayed till summary>
Iteration 31: 103,567 ms/op
·stack: <delayed till summary>
Iteration 32: 104,102 ms/op
·stack: <delayed till summary>
Iteration 33: 103,443 ms/op
·stack: <delayed till summary>
Iteration 34: 104,549 ms/op
·stack: <delayed till summary>
Iteration 35: 103,514 ms/op
·stack: <delayed till summary>
Iteration 36: 102,869 ms/op
·stack: <delayed till summary>
Iteration 37: 102,903 ms/op
·stack: <delayed till summary>
Iteration 38: 103,305 ms/op
·stack: <delayed till summary>
Iteration 39: 102,040 ms/op
·stack: <delayed till summary>
Iteration 40: 102,870 ms/op
·stack: <delayed till summary>
Iteration 41: 102,068 ms/op
·stack: <delayed till summary>
Iteration 42: 104,390 ms/op
·stack: <delayed till summary>
> Task :jmh
Result "bench.FactorialBench.c_tailRecursive_sc":
104,385 ±(99.9%) 1,380 ms/op [Average]
(min, avg, max) = (101,158, 104,385, 113,281), stdev = 2,523
CI (99.9%): [103,005, 105,765] (assumes normal distribution)
Secondary result "bench.FactorialBench.c_tailRecursive_sc:·stack":
Stack profiler:
....[Thread state distributions]....................................................................
100,0% RUNNABLE
....[Thread state: RUNNABLE]........................................................................
97,1% 97,2% org.codehaus.groovy.runtime.typehandling.NumberMath.multiply
1,1% 1,1% bench.FactorialBench.factorialTailRecursiveSC
0,8% 0,8% java.math.BigInteger.multiplyByInt
0,2% 0,2% java.math.BigInteger.valueOf
0,2% 0,2% bench.FactorialBench.c_tailRecursive_sc
0,2% 0,2% java.util.Arrays.copyOfRange
0,1% 0,1% java.lang.Thread.isInterrupted
0,1% 0,1% java.math.BigInteger.<init>
0,1% 0,1% java.lang.System.nanoTime
0,0% 0,0% sun.misc.Unsafe.unpark
# Run complete. Total time: 00:08:17
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.
Benchmark Mode Cnt Score Error Units
FactorialBench.a_standard avgt 42 472,114 ± 1,315 ms/op
FactorialBench.a_standard:·stack avgt NaN ---
FactorialBench.a_standard_sc avgt 42 428,717 ± 1,063 ms/op
FactorialBench.a_standard_sc:·stack avgt NaN ---
FactorialBench.b_trampoline avgt 42 1054,703 ± 3,805 ms/op
FactorialBench.b_trampoline:·stack avgt NaN ---
FactorialBench.b_trampoline_sc avgt 42 683,293 ± 2,191 ms/op
FactorialBench.b_trampoline_sc:·stack avgt NaN ---
FactorialBench.c_tailRecursive avgt 42 322,019 ± 1,409 ms/op
FactorialBench.c_tailRecursive:·stack avgt NaN ---
FactorialBench.c_tailRecursive_sc avgt 42 104,385 ± 1,380 ms/op
FactorialBench.c_tailRecursive_sc:·stack avgt NaN ---
Benchmark result is saved to /home/wololock/workspace/groovy-closure-trampoline-example/build/reports/jmh/results.txt
BUILD SUCCESSFUL in 8m 25s
6 actionable tasks: 6 executed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment