diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-07-16 13:06:38 +1000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-07-15 22:32:43 -0700 |
commit | a2973dfd954c0c094f956becb05a82bee5f7da01 (patch) | |
tree | 2135ee1616ff3920d00c35046be2037af9aa3a3f /test/benchmarking/ParCtrie-bfs.scala | |
parent | fa8012d28687986902ce1255a19f9f49affb3bca (diff) | |
download | scala-a2973dfd954c0c094f956becb05a82bee5f7da01.tar.gz scala-a2973dfd954c0c094f956becb05a82bee5f7da01.tar.bz2 scala-a2973dfd954c0c094f956becb05a82bee5f7da01.zip |
Remove further references to forkjoin
Use j.u.c.Forkjoin directly in active and disabled tests
Remove bitrotted benchmarks code
I was going to update these to use `java.util.concurrent.ForkJoin`
directly, instead of our deprecated stubs.
But most of them don't compile anymore (e.g. scala.testing.Benchmark
has been removed, ClassTag imports missing).
While I'm all for benchmarks, we should have large swathes of code
checked in that isn't at compiled and run automatically.
I'm happy to help someone resurrect these in a suitable form.
Diffstat (limited to 'test/benchmarking/ParCtrie-bfs.scala')
-rw-r--r-- | test/benchmarking/ParCtrie-bfs.scala | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/test/benchmarking/ParCtrie-bfs.scala b/test/benchmarking/ParCtrie-bfs.scala deleted file mode 100644 index 59149fff8c..0000000000 --- a/test/benchmarking/ParCtrie-bfs.scala +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -import collection.parallel.mutable.ParCtrie - - -object Bfs extends testing.Benchmark { - val length = sys.props("length").toInt - val par = sys.props("par").toInt - - type Node = (Int, Int); - type Parent = (Int, Int); - - def up(n: Node) = (n._1, n._2 - 1); - def down(n: Node) = (n._1, n._2 + 1); - def left(n: Node) = (n._1 - 1, n._2); - def right(n: Node) = (n._1 + 1, n._2); - - // create a map and a target - val target = (length / 2, length / 2); - val map = Array.tabulate(length, length)((x, y) => (x % 3) != 0 || (y % 3) != 0 || (x, y) == target) - def onMap(n: Node) = n._1 >= 0 && n._1 < length && n._2 >= 0 && n._2 < length - - // open and closed lists - val open = ParCtrie[Node, Parent]() - val closed = ParCtrie[Node, Parent]() - - collection.parallel.ForkJoinTasks.defaultForkJoinPool.setParallelism(par) - - override def setUp() { - open.clear() - closed.clear() - - // a couple of starting positions - open((0, 0)) = null - open((length - 1, length - 1)) = null - open((0, length - 1)) = null - open((length - 1, 0)) = null - } - - def run() = { - // greedy bfs path search - while (open.nonEmpty && !open.contains(target)) { - for ((node, parent) <- open) { - def expand(next: Node) { - if (onMap(next) && map(next._1)(next._2) && !closed.contains(next) && !open.contains(next)) { - open(next) = node - } - } - expand(up(node)) - expand(down(node)) - expand(left(node)) - expand(right(node)) - closed(node) = parent - open.remove(node) - } - } - } - - override def tearDown() { - // print path - var pathnode = open(target) - while (closed.contains(pathnode)) { - print(pathnode + "->") - pathnode = closed(pathnode) - } - println() - } - -} - |