tag:blogger.com,1999:blog-4815481734454081491.post2875283567488027918..comments2023-10-24T02:15:03.269-07:00Comments on Minborg's Java Pot: Java Performance: For-looping vs. StreamingPer Minborghttp://www.blogger.com/profile/08526963148025854611noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4815481734454081491.post-54832283797313085452019-09-13T10:03:52.543-07:002019-09-13T10:03:52.543-07:00Hi. Not sure I understand your comment. I am using...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.<br /><br />In your example, you use blackhole to consume the result which is another way of eliminating dead code elimination.Per Minborghttps://www.blogger.com/profile/08526963148025854611noreply@blogger.comtag:blogger.com,1999:blog-4815481734454081491.post-58744240873531613632019-09-12T08:09:46.374-07:002019-09-12T08:09:46.374-07:00Wouldn't it be better to avoid compiler optimi...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) ?<br />This is how I used it in practice https://github.com/pgilad/java-micro-benchmark-example/blob/master/src/main/java/org/sample/ArraySlicingBenchmark.javaGilad Peleghttps://www.blogger.com/profile/05406331982368560513noreply@blogger.com