diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-10-28 12:10:10 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-10-28 12:10:10 +0000 |
commit | 750b5244eeb2484e0cd37117c0e6c9f0b7c5c57a (patch) | |
tree | e575c054cb0b6b6e6aff27c77741f453d9645007 /src/library | |
parent | b7a344e93fbbcdf2392ed4be99c3a49dc5b8a9d9 (diff) | |
download | scala-750b5244eeb2484e0cd37117c0e6c9f0b7c5c57a.tar.gz scala-750b5244eeb2484e0cd37117c0e6c9f0b7c5c57a.tar.bz2 scala-750b5244eeb2484e0cd37117c0e6c9f0b7c5c57a.zip |
Performance bug in hash table splitter fixed, ...
Performance bug in hash table splitter fixed, where size map was not
used and all the elements were counted instead.
Performance tests now pass.
No review
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/parallel/mutable/ParHashMap.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/parallel/mutable/ParHashTable.scala | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/library/scala/collection/parallel/mutable/ParHashMap.scala b/src/library/scala/collection/parallel/mutable/ParHashMap.scala index c87584d81e..7e4e26d758 100644 --- a/src/library/scala/collection/parallel/mutable/ParHashMap.scala +++ b/src/library/scala/collection/parallel/mutable/ParHashMap.scala @@ -106,6 +106,8 @@ self => object ParHashMap extends ParMapFactory[ParHashMap] { + var iters = 0 + def empty[K, V]: ParHashMap[K, V] = new ParHashMap[K, V] def newCombiner[K, V]: Combiner[(K, V), ParHashMap[K, V]] = ParHashMapCombiner.apply[K, V] diff --git a/src/library/scala/collection/parallel/mutable/ParHashTable.scala b/src/library/scala/collection/parallel/mutable/ParHashTable.scala index 8f7ff72103..a9ab577b55 100644 --- a/src/library/scala/collection/parallel/mutable/ParHashTable.scala +++ b/src/library/scala/collection/parallel/mutable/ParHashTable.scala @@ -30,9 +30,11 @@ trait ParHashTable[K, Entry >: Null <: HashEntry[K, Entry]] extends collection.m def entry2item(e: Entry): T def newIterator(idxFrom: Int, idxUntil: Int, totalSize: Int, es: Entry): IterRepr - def hasNext = es != null + def hasNext = { + es ne null + } - def next = { + def next: T = { val res = es es = es.next scan() @@ -113,7 +115,9 @@ trait ParHashTable[K, Entry >: Null <: HashEntry[K, Entry]] extends collection.m val fbindex = from / sizeMapBucketSize // find the last bucket - val lbindex = from / sizeMapBucketSize + val lbindex = until / sizeMapBucketSize + // note to self: FYI if you define lbindex as from / sizeMapBucketSize, the first branch + // below always triggers and tests pass, so you spend a great day benchmarking and profiling if (fbindex == lbindex) { // if first and last are the same, just count between `from` and `until` @@ -164,5 +168,7 @@ trait ParHashTable[K, Entry >: Null <: HashEntry[K, Entry]] extends collection.m - +object ParHashTable { + var iters = 0 +} |