From 86946630e9a1240fb9a378b2ec62e78b521f4320 Mon Sep 17 00:00:00 2001 From: Aleksandar Prokopec Date: Fri, 3 Feb 2012 15:05:56 +0100 Subject: Fix some issues in parallel Ctrie. This change resolves some issues with ParCtrie splitters and their `remaining` method, which currently evaluates the size of the Ctrie. Since this is still not done lazily, nor in parallel, it has a certain cost, which is unacceptable. Change #1: The `shouldSplitFurther` method is by default implemented by calling the `remaining` method. This method now forwards the call to the same method in the splitter which is by default implemented in the same way as before, but can be overridden by custom collections such as the ParCtrie. Change #2: ParCtrie splitter now has a `level` member which just counts how many times the method has been split. This information is used to override the default `shouldSplitFurther` implementation. Change #3: The tasks and splitters rely heavily on the `remaining` method in the splitter for most operations. There is an additional method called `isRemainingCheap` which returns true by default, but can be overridden by custom collections such as the `Ctrie`. --- test/benchmarking/TreeSetInsert.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/benchmarking/TreeSetInsert.scala') diff --git a/test/benchmarking/TreeSetInsert.scala b/test/benchmarking/TreeSetInsert.scala index 9ede8aedc5..23444aa305 100644 --- a/test/benchmarking/TreeSetInsert.scala +++ b/test/benchmarking/TreeSetInsert.scala @@ -33,6 +33,7 @@ object JavaUtilTS extends testing.Benchmark { } } + object MutableTS extends testing.Benchmark { val length = sys.props("length").toInt var data: Array[Dummy] = (0 until length) map { a => new Dummy(a) } toArray @@ -50,6 +51,7 @@ object MutableTS extends testing.Benchmark { } } + object ImmutableTS extends testing.Benchmark { val length = sys.props("length").toInt var data: Array[Dummy] = (0 until length) map { a => new Dummy(a) } toArray -- cgit v1.2.3