diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2012-02-01 16:50:31 +0100 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2012-02-01 17:04:47 +0100 |
commit | fe289dc0fd8172012e4d57d09658e2dfd0a4cdcf (patch) | |
tree | 4f2cbda8a78221524c5b4ba400a040061bfb43f8 /test/disabled-windows | |
parent | 37bcff7956451cd74d08899e0e49c8b569d3a882 (diff) | |
download | scala-fe289dc0fd8172012e4d57d09658e2dfd0a4cdcf.tar.gz scala-fe289dc0fd8172012e4d57d09658e2dfd0a4cdcf.tar.bz2 scala-fe289dc0fd8172012e4d57d09658e2dfd0a4cdcf.zip |
Add support for combiner sharing to parallel collections.
Concurrent (thread-safe) collections can implement builders directly
for parallel collections by having themselves as builders, similar
to buffers being builders for themselves in sequential collections.
Combining 2 shared combiners can be expensive (more than logn), but
is never done, since `combine` is always called with `this` (receiver)
combiner, so `combine` just returns `this`.
This commit adds support for implementing a parallel collection by
having itself as combiner (parallel builder). To do this, clients
must now merely implement their combiners by overriding the method
`canBeShared` and having it return `true`.
The support is implemented by refining the abstraction which creates
combiners in tasks - this abstraction is provided by the
protected `combinerFactory` method, previously `cbfactory`.
The essential difference is that if the combiner can be shared, this
method returns a combiner factory which always returns the same combiner.
Otherwise, it always creates a new combiner.
Span and takeWhile had to be modified for shared combiners to make this
work, but for all other collections they work as before.
Several other tasks had to be modified slightly, as well.
Diffstat (limited to 'test/disabled-windows')
0 files changed, 0 insertions, 0 deletions