summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/parallel/mutable/ParHashTable.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-28 12:10:10 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-28 12:10:10 +0000
commit750b5244eeb2484e0cd37117c0e6c9f0b7c5c57a (patch)
treee575c054cb0b6b6e6aff27c77741f453d9645007 /src/library/scala/collection/parallel/mutable/ParHashTable.scala
parentb7a344e93fbbcdf2392ed4be99c3a49dc5b8a9d9 (diff)
downloadscala-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/scala/collection/parallel/mutable/ParHashTable.scala')
-rw-r--r--src/library/scala/collection/parallel/mutable/ParHashTable.scala14
1 files changed, 10 insertions, 4 deletions
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
+}