diff options
-rw-r--r-- | src/library/scala/concurrent/impl/ExecutionContextImpl.scala | 2 | ||||
-rw-r--r-- | src/library/scala/concurrent/impl/Future.scala | 2 | ||||
-rw-r--r-- | src/library/scala/concurrent/impl/Promise.scala | 2 | ||||
-rw-r--r-- | src/library/scala/parallel/Future.scala | 3 | ||||
-rw-r--r-- | test/benchmarking/ParHashMap.scala | 33 | ||||
-rw-r--r-- | test/benchmarking/ParVector-reduce.scala | 33 |
6 files changed, 72 insertions, 3 deletions
diff --git a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala index 7984aa02b7..6201de14d7 100644 --- a/src/library/scala/concurrent/impl/ExecutionContextImpl.scala +++ b/src/library/scala/concurrent/impl/ExecutionContextImpl.scala @@ -18,7 +18,7 @@ import scala.collection.mutable.Stack -class ExecutionContextImpl(val executorService: AnyRef) extends ExecutionContext { +private[scala] class ExecutionContextImpl(val executorService: AnyRef) extends ExecutionContext { import ExecutionContextImpl._ def execute(runnable: Runnable): Unit = executorService match { diff --git a/src/library/scala/concurrent/impl/Future.scala b/src/library/scala/concurrent/impl/Future.scala index 9466761d4d..b4385ea34a 100644 --- a/src/library/scala/concurrent/impl/Future.scala +++ b/src/library/scala/concurrent/impl/Future.scala @@ -12,7 +12,7 @@ import scala.concurrent.{Awaitable, ExecutionContext} import scala.util.{ Try, Success, Failure } //import scala.util.continuations._ -trait Future[+T] extends scala.concurrent.Future[T] with Awaitable[T] { +private[concurrent] trait Future[+T] extends scala.concurrent.Future[T] with Awaitable[T] { implicit def executor: ExecutionContextImpl diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala index 0087b71ea8..5238bc51db 100644 --- a/src/library/scala/concurrent/impl/Promise.scala +++ b/src/library/scala/concurrent/impl/Promise.scala @@ -22,7 +22,7 @@ import scala.annotation.tailrec -trait Promise[T] extends scala.concurrent.Promise[T] with Future[T] { +private[concurrent] trait Promise[T] extends scala.concurrent.Promise[T] with Future[T] { def future = this diff --git a/src/library/scala/parallel/Future.scala b/src/library/scala/parallel/Future.scala index af06852b32..f61d376093 100644 --- a/src/library/scala/parallel/Future.scala +++ b/src/library/scala/parallel/Future.scala @@ -8,11 +8,14 @@ package scala.parallel + + /** A future is a function without parameters that will block the caller if * the parallel computation associated with the function is not completed. * * @since 2.9 */ +@deprecated("Use `scala.concurrent.Future` instead.", "2.10.0") trait Future[@specialized +R] extends (() => R) { /** Returns a result once the parallel computation completes. If the * computation produced an exception, an exception is forwarded. 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 + } + } +} + diff --git a/test/benchmarking/ParVector-reduce.scala b/test/benchmarking/ParVector-reduce.scala new file mode 100644 index 0000000000..2b4594e997 --- /dev/null +++ b/test/benchmarking/ParVector-reduce.scala @@ -0,0 +1,33 @@ + + + +import collection.parallel.immutable.ParVector + + + +object Reduce extends testing.Benchmark { + val length = sys.props("length").toInt + val par = sys.props("par").toInt + val parvector = ParVector((0 until length): _*) + + parvector.tasksupport = new collection.parallel.ForkJoinTaskSupport(new scala.concurrent.forkjoin.ForkJoinPool(par)) + + def run = { + parvector reduce { + (a, b) => a + b + } + } +} + + +object ReduceSeq extends testing.Benchmark { + val length = sys.props("length").toInt + val vector = collection.immutable.Vector((0 until length): _*) + + def run = { + vector reduce { + (a, b) => a + b + } + } +} + |