Skip to content

Instantly share code, notes, and snippets.

@MaggieLeber
Created January 30, 2016 19:32
Show Gist options
  • Save MaggieLeber/e311695a430abedfca93 to your computer and use it in GitHub Desktop.
Save MaggieLeber/e311695a430abedfca93 to your computer and use it in GitHub Desktop.
Scala parallel collections benchmark
// http://docs.scala-lang.org/overviews/parallel-collections/performance.html
import collection.parallel.mutable.ParTrieMap
import collection.parallel.ForkJoinTaskSupport
object Map extends testing.Benchmark {
val length = sys.props("length").toInt
val par = sys.props("par").toInt
val partrie = ParTrieMap((0 until length) zip (0 until length): _*)
partrie.tasksupport = new ForkJoinTaskSupport(new scala.concurrent.forkjoin.ForkJoinPool(par))
def run = {
partrie map {
kv => kv
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment