Reference Citations - HerongYang.com - v2.91, by Dr. Herong Yang
[scala-user] for-loops still not optimized in 2.10?
'What Is Micro Benchmark?' tutorial was cited in a Grokbase forum in 2013.
The What Is Micro Benchmark? tutorial was cited in a Grokbase forum post in 2013.
Subject: [scala-user] for-loops still not optimized in 2.10? Date: Apr 10, 2013 Author: Rex Kerr Source: http://grokbase.com/t/gg/scala-user/134816ytca /for-loops-still-not-optimized-in-2-10 >I have code that repeatedly computes dot products of Double vectors. >I've replaced the functional version, which was too slow, with a for- >loop and a var. However, this version is still slower than my >previous Ocaml version (which uses zip and map). I've therefore >replaced it by a while-loop, which is 2.5 times faster than the for- >loop. > >I've compiled the code with Scala 2.10 and -optimize. > >What kind of optimization does Scala do for for-loops? Is a >significant difference to while-loops still to be expected? > >... The very first thing I said about benchmarking is that you weren't measuring what you thought you were (or at least not what you were claiming to measure), explained what you were measuring, and suggested tools that help reduce the burden of making accurate measurements. I'm not sure how you interpreted that as critical. (I was critical of the a(i++) thing, but that's a completely separate issue.) ... P.S. Maybe I should have linked to some JVM microbenchmarking articles initially (all mostly right, though I do not guarantee a complete absence of mistakes): https://wikis.oracle.com/display/HotSpotInternals/MicroBenchmarks http://www.ibm.com/developerworks/java/library/j-jtp02225/index.html http://www.kdgregory.com/index.php?page=java.microBenchmark http://www.herongyang.com/JVM /Micro-Benchmark-What-Is-Micro-Benchmark.html
Table of Contents