summaryrefslogtreecommitdiff
path: root/test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-06-07 10:15:32 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-06-07 10:15:32 +0000
commite67f56076624ea83383901934a30280d7f97380f (patch)
treea28b45d7a79ff9002735ea225b3a4733ac4d0234 /test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala
parentdd396886d0da88326e5e4772af4d8813360ea8a5 (diff)
downloadscala-e67f56076624ea83383901934a30280d7f97380f.tar.gz
scala-e67f56076624ea83383901934a30280d7f97380f.tar.bz2
scala-e67f56076624ea83383901934a30280d7f97380f.zip
Adding parallel collections to trunk.
sabbus also edited to add parallel collections to the library jar - review by phaller
Diffstat (limited to 'test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala')
-rw-r--r--test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala
new file mode 100644
index 0000000000..4ee8c17118
--- /dev/null
+++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/Lookup.scala
@@ -0,0 +1,57 @@
+package scala.collection.parallel.benchmarks
+package hashtries
+
+
+
+
+import collection.immutable.{HashMap => HashTrie}
+import collection.mutable.HashMap
+
+
+
+
+
+
+class Lookup(val size: Int, val parallelism: Int, val runWhat: String) extends Bench with IntInit {
+ def runpar = throw new UnsupportedOperationException
+ def runseq = throw new UnsupportedOperationException
+ def runhashmap = {
+ var i = 0
+ while (i < size) {
+ hashmap(i)
+ i += 1
+ }
+ }
+ def runhashtrie = {
+ var i = 0
+ while (i < size) {
+ hashtrie(i)
+ i += 1
+ }
+ }
+ def companion = Iterate
+ def comparisonMap = Map("hashmap" -> runhashmap _, "hashtrie" -> runhashtrie _)
+}
+
+
+object Lookup extends BenchCompanion {
+ def collectionName = "HashTrie"
+ def benchName = "lookup";
+ def apply(sz: Int, p: Int, what: String) = new Lookup(sz, p, what)
+ override def defaultSize = 25000
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+