Created
January 30, 2016 19:32
-
-
Save MaggieLeber/e311695a430abedfca93 to your computer and use it in GitHub Desktop.
Scala parallel collections benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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