Use ScalaBlitz optimize block, to make collection operations faster!
Simply import the scala.collection.optimizer
package,
and take full advantage of it.
Eg. this example becomes 2x faster!
import scala.collection.optimizer._
def average(x: List[Double]) = optimize {
x.sum / x.size
}
import scala.collection.par._
import Scheduler.Implicits.global
(0 until 15000000).toPar.reduce(_ + _)
With ScalaBlitz, parallelism is just 3 lines of code away!
Simply import the scala.collection.par
package and the
default scheduler, and let your programs benefit from parallelism
with a mere toPar
call on your collections.
Execute data-parallel operations on arrays, ranges, hash tables or balanced trees seamlessly! Have your collection operations automatically specialized and programs highly optimized. Rely on highly efficient data-parallel scheduling.
def triangles(n: Int) = for {
x <- (0 until n).toPar
y <- 0 until x
} yield { y }: @unchecked
Features
- highly optimized collection operations based on Scala Macros
- variety of supported collection types and Scala standard library collections interoperability
- flexible API easily extendable to custom collections
- seamless data-parallel operations integration
- data-parallel scheduling suitable both for fine-grained uniform and irregular workloads
- custom configurable data-parallel schedulers
See the Documentation section for instructions and more examples.