What is the performance difference between Scala2.10 and 2.9.2?
In this issue, the editor will bring you about the performance difference between Scala2.10 and 2.9.2. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.
I have read some of the new features of Scala 2.10.0-RC3, and the most interesting thing about this version is the performance improvement. I was curious about the extent of the improvement, so I did a benchmark test. Here are the code for my two tests:
Eratosthenes screening
Def eratosthenes (toNum: Int) = {def sieveHelp (r: IndexedSeq [Int]): Stream [Int] = {if (r.isEmpty) Stream.empty else r.head #:: sieveHelp (r.tail.filterNot (_% r.head = = 0))} sieveHelp (2 +: (3 to toNum by 2))}
Sundaram screening
Def sundaram (toNum: Int) = {val n = (toNum-2) / 2 val nonPrimes = for (I