diff options
Diffstat (limited to 'test/benchmarking/ParHashMap.scala')
-rw-r--r-- | test/benchmarking/ParHashMap.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/benchmarking/ParHashMap.scala b/test/benchmarking/ParHashMap.scala new file mode 100644 index 0000000000..33a378fb04 --- /dev/null +++ b/test/benchmarking/ParHashMap.scala @@ -0,0 +1,33 @@ + + + +import collection.parallel.mutable.ParHashMap + + + +object Map extends testing.Benchmark { + val length = sys.props("length").toInt + val par = sys.props("par").toInt + val phm = ParHashMap((0 until length) zip (0 until length): _*) + + phm.tasksupport = new collection.parallel.ForkJoinTaskSupport(new scala.concurrent.forkjoin.ForkJoinPool(par)) + + def run = { + phm map { + kv => kv + } + } +} + + +object MapSeq extends testing.Benchmark { + val length = sys.props("length").toInt + val hm = collection.mutable.HashMap((0 until length) zip (0 until length): _*) + + def run = { + hm map { + kv => kv + } + } +} + |