Comments on: Java Performance: For-looping vs. Streaming https://speedment.com/java-performance-for-looping-vs-streaming/ Build Fast Java Applications for the Fastest Business Performance Fri, 01 May 2020 05:21:37 +0000 hourly 1 https://wordpress.org/?v=5.1.1 By: Per Minborg https://speedment.com/java-performance-for-looping-vs-streaming/#comment-20 Fri, 13 Sep 2019 17:03:52 +0000 #comment-20 Hi. Not sure I understand your comment. I am using JMH and I do return the result of the computation to avoid dead code elimination. So, I believe the results are accurate and representative for the different variants.

In your example, you use blackhole to consume the result which is another way of eliminating dead code elimination.

]]>
By: Gilad Peleg https://speedment.com/java-performance-for-looping-vs-streaming/#comment-21 Thu, 12 Sep 2019 15:09:46 +0000 #comment-21 Wouldn't it be better to avoid compiler optimisations to get more accurate results and use the techniques here (http://tutorials.jenkov.com/java-performance/jmh.html) ?
This is how I used it in practice https://github.com/pgilad/java-micro-benchmark-example/blob/master/src/main/java/org/sample/ArraySlicingBenchmark.java

]]>