diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-12-09 10:08:20 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-12-09 10:08:20 +0000 |
commit | f2ecbd04691b1914e2f77c60afc2b296aa6826ae (patch) | |
tree | 539b543eb173cfc7b0bbde4ca5f2c5bb187297df /src/library/scala/collection/parallel/immutable/ParHashSet.scala | |
parent | 492b22576f2ad46b300ce8dc31c5b672aaf517e4 (diff) | |
download | scala-f2ecbd04691b1914e2f77c60afc2b296aa6826ae.tar.gz scala-f2ecbd04691b1914e2f77c60afc2b296aa6826ae.tar.bz2 scala-f2ecbd04691b1914e2f77c60afc2b296aa6826ae.zip |
Array combiners implementation changed from arr...
Array combiners implementation changed from array buffers to doubling
unrolled buffers to avoid excessive copying. Still evaluating the
benefits of this.
No review.
Diffstat (limited to 'src/library/scala/collection/parallel/immutable/ParHashSet.scala')
-rw-r--r-- | src/library/scala/collection/parallel/immutable/ParHashSet.scala | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/library/scala/collection/parallel/immutable/ParHashSet.scala b/src/library/scala/collection/parallel/immutable/ParHashSet.scala index 747ed3eed3..0b1f9c5b7e 100644 --- a/src/library/scala/collection/parallel/immutable/ParHashSet.scala +++ b/src/library/scala/collection/parallel/immutable/ParHashSet.scala @@ -61,10 +61,24 @@ self => type SCPI = SignalContextPassingIterator[ParHashSetIterator] - class ParHashSetIterator(val triter: Iterator[T], val sz: Int) + class ParHashSetIterator(var triter: Iterator[T], val sz: Int) extends super.ParIterator { self: SignalContextPassingIterator[ParHashSetIterator] => var i = 0 + def dup = triter match { + case t: HashSet.TrieIterator[_] => + val dupt = t.dupIterator.asInstanceOf[Iterator[T]] + dupFromIterator(dupt) + case _ => + val buff = triter.toBuffer + triter = buff.iterator + dupFromIterator(buff.iterator) + } + private def dupFromIterator(it: Iterator[T]) = { + val phit = new ParHashSetIterator(it, sz) with SCPI + phit.i = i + phit + } def split: Seq[ParIterator] = if (remaining < 2) Seq(this) else triter match { case t: HashSet.TrieIterator[_] => val previousRemaining = remaining |