Guest User

Functional vs Imperative Java benchmark

a guest
Nov 24th, 2015
1,086
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ java -jar benchmarks.jar
  2. # JMH 1.11.2 (released 26 days ago)
  3. # VM version: JDK 1.8.0_66, VM 25.66-b17
  4. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  5. # VM options: <none>
  6. # Warmup: 5 iterations, 1 s each
  7. # Measurement: 5 iterations, 1 s each
  8. # Timeout: 10 min per iteration
  9. # Threads: 1 thread, will synchronize iterations
  10. # Benchmark mode: Average time, time/op
  11. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.forEachLambdaMaxInteger
  12.  
  13. # Run progress: 0.00% complete, ETA 00:02:20
  14. # Fork: 1 of 2
  15. # Warmup Iteration 1: 0.867 ms/op
  16. # Warmup Iteration 2: 0.699 ms/op
  17. # Warmup Iteration 3: 0.675 ms/op
  18. # Warmup Iteration 4: 0.661 ms/op
  19. # Warmup Iteration 5: 0.562 ms/op
  20. Iteration 1: 0.564 ms/op
  21. Iteration 2: 0.568 ms/op
  22. Iteration 3: 0.563 ms/op
  23. Iteration 4: 0.567 ms/op
  24. Iteration 5: 0.567 ms/op
  25.  
  26. # Run progress: 7.14% complete, ETA 00:02:13
  27. # Fork: 2 of 2
  28. # Warmup Iteration 1: 0.857 ms/op
  29. # Warmup Iteration 2: 0.698 ms/op
  30. # Warmup Iteration 3: 0.675 ms/op
  31. # Warmup Iteration 4: 0.664 ms/op
  32. # Warmup Iteration 5: 0.560 ms/op
  33. Iteration 1: 0.562 ms/op
  34. Iteration 2: 0.565 ms/op
  35. Iteration 3: 0.565 ms/op
  36. Iteration 4: 0.566 ms/op
  37. Iteration 5: 0.566 ms/op
  38.  
  39.  
  40. Result "forEachLambdaMaxInteger":
  41. 0.565 ?(99.9%) 0.003 ms/op [Average]
  42. (min, avg, max) = (0.562, 0.565, 0.568), stdev = 0.002
  43. CI (99.9%): [0.562, 0.568] (assumes normal distribution)
  44.  
  45.  
  46. # JMH 1.11.2 (released 26 days ago)
  47. # VM version: JDK 1.8.0_66, VM 25.66-b17
  48. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  49. # VM options: <none>
  50. # Warmup: 5 iterations, 1 s each
  51. # Measurement: 5 iterations, 1 s each
  52. # Timeout: 10 min per iteration
  53. # Threads: 1 thread, will synchronize iterations
  54. # Benchmark mode: Average time, time/op
  55. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.forEachMaxInteger
  56.  
  57. # Run progress: 14.29% complete, ETA 00:02:03
  58. # Fork: 1 of 2
  59. # Warmup Iteration 1: 0.118 ms/op
  60. # Warmup Iteration 2: 0.116 ms/op
  61. # Warmup Iteration 3: 0.116 ms/op
  62. # Warmup Iteration 4: 0.116 ms/op
  63. # Warmup Iteration 5: 0.116 ms/op
  64. Iteration 1: 0.116 ms/op
  65. Iteration 2: 0.116 ms/op
  66. Iteration 3: 0.116 ms/op
  67. Iteration 4: 0.116 ms/op
  68. Iteration 5: 0.116 ms/op
  69.  
  70. # Run progress: 21.43% complete, ETA 00:01:53
  71. # Fork: 2 of 2
  72. # Warmup Iteration 1: 0.118 ms/op
  73. # Warmup Iteration 2: 0.116 ms/op
  74. # Warmup Iteration 3: 0.116 ms/op
  75. # Warmup Iteration 4: 0.116 ms/op
  76. # Warmup Iteration 5: 0.116 ms/op
  77. Iteration 1: 0.116 ms/op
  78. Iteration 2: 0.116 ms/op
  79. Iteration 3: 0.116 ms/op
  80. Iteration 4: 0.116 ms/op
  81. Iteration 5: 0.116 ms/op
  82.  
  83.  
  84. Result "forEachMaxInteger":
  85. 0.116 ?(99.9%) 0.001 ms/op [Average]
  86. (min, avg, max) = (0.116, 0.116, 0.116), stdev = 0.001
  87. CI (99.9%): [0.116, 0.116] (assumes normal distribution)
  88.  
  89.  
  90. # JMH 1.11.2 (released 26 days ago)
  91. # VM version: JDK 1.8.0_66, VM 25.66-b17
  92. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  93. # VM options: <none>
  94. # Warmup: 5 iterations, 1 s each
  95. # Measurement: 5 iterations, 1 s each
  96. # Timeout: 10 min per iteration
  97. # Threads: 1 thread, will synchronize iterations
  98. # Benchmark mode: Average time, time/op
  99. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.forMaxInteger
  100.  
  101. # Run progress: 28.57% complete, ETA 00:01:42
  102. # Fork: 1 of 2
  103. # Warmup Iteration 1: 0.232 ms/op
  104. # Warmup Iteration 2: 0.231 ms/op
  105. # Warmup Iteration 3: 0.230 ms/op
  106. # Warmup Iteration 4: 0.230 ms/op
  107. # Warmup Iteration 5: 0.230 ms/op
  108. Iteration 1: 0.230 ms/op
  109. Iteration 2: 0.230 ms/op
  110. Iteration 3: 0.230 ms/op
  111. Iteration 4: 0.230 ms/op
  112. Iteration 5: 0.230 ms/op
  113.  
  114. # Run progress: 35.71% complete, ETA 00:01:32
  115. # Fork: 2 of 2
  116. # Warmup Iteration 1: 0.231 ms/op
  117. # Warmup Iteration 2: 0.230 ms/op
  118. # Warmup Iteration 3: 0.229 ms/op
  119. # Warmup Iteration 4: 0.229 ms/op
  120. # Warmup Iteration 5: 0.229 ms/op
  121. Iteration 1: 0.229 ms/op
  122. Iteration 2: 0.230 ms/op
  123. Iteration 3: 0.229 ms/op
  124. Iteration 4: 0.229 ms/op
  125. Iteration 5: 0.229 ms/op
  126.  
  127.  
  128. Result "forMaxInteger":
  129. 0.230 ?(99.9%) 0.001 ms/op [Average]
  130. (min, avg, max) = (0.229, 0.230, 0.230), stdev = 0.001
  131. CI (99.9%): [0.229, 0.230] (assumes normal distribution)
  132.  
  133.  
  134. # JMH 1.11.2 (released 26 days ago)
  135. # VM version: JDK 1.8.0_66, VM 25.66-b17
  136. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  137. # VM options: <none>
  138. # Warmup: 5 iterations, 1 s each
  139. # Measurement: 5 iterations, 1 s each
  140. # Timeout: 10 min per iteration
  141. # Threads: 1 thread, will synchronize iterations
  142. # Benchmark mode: Average time, time/op
  143. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.iteratorMaxInteger
  144.  
  145. # Run progress: 42.86% complete, ETA 00:01:22
  146. # Fork: 1 of 2
  147. # Warmup Iteration 1: 0.118 ms/op
  148. # Warmup Iteration 2: 0.116 ms/op
  149. # Warmup Iteration 3: 0.116 ms/op
  150. # Warmup Iteration 4: 0.116 ms/op
  151. # Warmup Iteration 5: 0.116 ms/op
  152. Iteration 1: 0.116 ms/op
  153. Iteration 2: ^@0.116 ms/op
  154. Iteration 3: 0.116 ms/op
  155. Iteration 4: 0.116 ms/op
  156. Iteration 5: 0.116 ms/op
  157.  
  158. # Run progress: 50.00% complete, ETA 00:01:12
  159. # Fork: 2 of 2
  160. # Warmup Iteration 1: 0.118 ms/op
  161. # Warmup Iteration 2: 0.116 ms/op
  162. # Warmup Iteration 3: 0.116 ms/op
  163. # Warmup Iteration 4: 0.116 ms/op
  164. # Warmup Iteration 5: 0.116 ms/op
  165. Iteration 1: 0.116 ms/op
  166. Iteration 2: 0.116 ms/op
  167. Iteration 3: 0.116 ms/op
  168. Iteration 4: 0.116 ms/op
  169. Iteration 5: 0.116 ms/op
  170.  
  171.  
  172. Result "iteratorMaxInteger":
  173. 0.116 ?(99.9%) 0.001 ms/op [Average]
  174. (min, avg, max) = (0.116, 0.116, 0.116), stdev = 0.001
  175. CI (99.9%): [0.115, 0.116] (assumes normal distribution)
  176.  
  177.  
  178. # JMH 1.11.2 (released 26 days ago)
  179. # VM version: JDK 1.8.0_66, VM 25.66-b17
  180. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  181. # VM options: <none>
  182. # Warmup: 5 iterations, 1 s each
  183. # Measurement: 5 iterations, 1 s each
  184. # Timeout: 10 min per iteration
  185. # Threads: 1 thread, will synchronize iterations
  186. # Benchmark mode: Average time, time/op
  187. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.lambdaMaxInteger
  188.  
  189. # Run progress: 57.14% complete, ETA 00:01:01
  190. # Fork: 1 of 2
  191. # Warmup Iteration 1: 0.728 ms/op
  192. # Warmup Iteration 2: 0.588 ms/op
  193. # Warmup Iteration 3: 0.572 ms/op
  194. # Warmup Iteration 4: 0.554 ms/op
  195. # Warmup Iteration 5: 0.543 ms/op
  196. Iteration 1: 0.543 ms/op
  197. Iteration 2: 0.545 ms/op
  198. Iteration 3: 0.548 ms/op
  199. Iteration 4: 0.548 ms/op
  200. Iteration 5: 0.547 ms/op
  201.  
  202. # Run progress: 64.29% complete, ETA 00:00:51
  203. # Fork: 2 of 2
  204. # Warmup Iteration 1: 0.726 ms/op
  205. # Warmup Iteration 2: 0.587 ms/op
  206. # Warmup Iteration 3: 0.566 ms/op
  207. # Warmup Iteration 4: 0.550 ms/op
  208. # Warmup Iteration 5: 0.543 ms/op
  209. Iteration 1: 0.545 ms/op
  210. Iteration 2: 0.548 ms/op
  211. Iteration 3: 0.548 ms/op
  212. Iteration 4: 0.549 ms/op
  213. Iteration 5: 0.547 ms/op
  214.  
  215.  
  216. Result "lambdaMaxInteger":
  217. 0.547 ?(99.9%) 0.003 ms/op [Average]
  218. (min, avg, max) = (0.543, 0.547, 0.549), stdev = 0.002
  219. CI (99.9%): [0.544, 0.549] (assumes normal distribution)
  220.  
  221.  
  222. # JMH 1.11.2 (released 26 days ago)
  223. # VM version: JDK 1.8.0_66, VM 25.66-b17
  224. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  225. # VM options: <none>
  226. # Warmup: 5 iterations, 1 s each
  227. # Measurement: 5 iterations, 1 s each
  228. # Timeout: 10 min per iteration
  229. # Threads: 1 thread, will synchronize iterations
  230. # Benchmark mode: Average time, time/op
  231. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.parallelStreamMaxInteger
  232.  
  233. # Run progress: 71.43% complete, ETA 00:00:41
  234. # Fork: 1 of 2
  235. # Warmup Iteration 1: 0.539 ms/op
  236. # Warmup Iteration 2: 0.396 ms/op
  237. # Warmup Iteration 3: 0.394 ms/op
  238. # Warmup Iteration 4: 0.399 ms/op
  239. # Warmup Iteration 5: 0.399 ms/op
  240. Iteration 1: 0.407 ms/op
  241. Iteration 2: 0.409 ms/op
  242. Iteration 3: 0.463 ms/op
  243. Iteration 4: 0.470 ms/op
  244. Iteration 5: 0.468 ms/op
  245.  
  246. # Run progress: 78.57% complete, ETA 00:00:30
  247. # Fork: 2 of 2
  248. # Warmup Iteration 1: 0.555 ms/op
  249. # Warmup Iteration 2: 0.406 ms/op
  250. # Warmup Iteration 3: 0.411 ms/op
  251. # Warmup Iteration 4: 0.407 ms/op
  252. # Warmup Iteration 5: 0.406 ms/op
  253. Iteration 1: 0.414 ms/op
  254. Iteration 2: 0.410 ms/op
  255. Iteration 3: 0.406 ms/op
  256. Iteration 4: 0.407 ms/op
  257. Iteration 5: 0.411 ms/op
  258.  
  259.  
  260. Result "parallelStreamMaxInteger":
  261. 0.426 ?(99.9%) 0.042 ms/op [Average]
  262. (min, avg, max) = (0.406, 0.426, 0.470), stdev = 0.028
  263. CI (99.9%): [0.384, 0.469] (assumes normal distribution)
  264.  
  265.  
  266. # JMH 1.11.2 (released 26 days ago)
  267. # VM version: JDK 1.8.0_66, VM 25.66-b17
  268. # VM invoker: /usr/lib/jvm/java-8-oracle/jre/bin/java
  269. # VM options: <none>
  270. # Warmup: 5 iterations, 1 s each
  271. # Measurement: 5 iterations, 1 s each
  272. # Timeout: 10 min per iteration
  273. # Threads: 1 thread, will synchronize iterations
  274. # Benchmark mode: Average time, time/op
  275. # Benchmark: com.takipi.oss.benchmarks.jmh.loops.LoopBenchmarkMain.streamMaxInteger
  276.  
  277. # Run progress: 85.71% complete, ETA 00:00:20
  278. # Fork: 1 of 2
  279. # Warmup Iteration 1: 0.751 ms/op
  280. # Warmup Iteration 2: 0.598 ms/op
  281. # Warmup Iteration 3: 0.581 ms/op
  282. # Warmup Iteration 4: 0.607 ms/op
  283. # Warmup Iteration 5: 0.626 ms/op
  284. Iteration 1: ^@0.627 ms/op
  285. Iteration 2: 0.629 ms/op
  286. Iteration 3: 0.632 ms/op
  287. Iteration 4: 0.631 ms/op
  288. Iteration 5: 0.628 ms/op
  289.  
  290. # Run progress: 92.86% complete, ETA 00:00:10
  291. # Fork: 2 of 2
  292. # Warmup Iteration 1: 0.740 ms/op
  293. # Warmup Iteration 2: 0.599 ms/op
  294. # Warmup Iteration 3: 0.578 ms/op
  295. # Warmup Iteration 4: 0.610 ms/op
  296. # Warmup Iteration 5: 0.626 ms/op
  297. Iteration 1: 0.628 ms/op
  298. Iteration 2: 0.631 ms/op
  299. Iteration 3: 0.632 ms/op
  300. Iteration 4: 0.631 ms/op
  301. Iteration 5: 0.631 ms/op
  302.  
  303.  
  304. Result "streamMaxInteger":
  305. 0.630 ?(99.9%) 0.003 ms/op [Average]
  306. (min, avg, max) = (0.627, 0.630, 0.632), stdev = 0.002
  307. CI (99.9%): [0.627, 0.633] (assumes normal distribution)
  308.  
  309.  
  310. # Run complete. Total time: 00:02:24
  311.  
  312. Benchmark Mode Cnt Score Error Units
  313. LoopBenchmarkMain.forEachLambdaMaxInteger avgt 10 0.565 ? 0.003 ms/op
  314. LoopBenchmarkMain.forEachMaxInteger avgt 10 0.116 ? 0.001 ms/op
  315. LoopBenchmarkMain.forMaxInteger avgt 10 0.230 ? 0.001 ms/op
  316. LoopBenchmarkMain.iteratorMaxInteger avgt 10 0.116 ? 0.001 ms/op
  317. LoopBenchmarkMain.lambdaMaxInteger avgt 10 0.547 ? 0.003 ms/op
  318. LoopBenchmarkMain.parallelStreamMaxInteger avgt 10 0.426 ? 0.042 ms/op
  319. LoopBenchmarkMain.streamMaxInteger avgt 10 0.630 ? 0.003 ms/op
RAW Paste Data