Skip to content

Parallelization

Choose a tag to compare

@orxfun orxfun released this 17 May 21:27
· 149 commits to main since this release
6c0d040

Support for Parallelization

Concurrent iterator optimized for the split vector is implemented. This enables parallel computation over split vector elements.

Concurrent Iterator

Concurrent iterator over references of split vector is implemented. Furthermore, a consuming concurrent iterator yielding owned elements is implemented.

impl<'a, T, G> IntoConcurrentIter<Item = &'a T> for &'a SplitVec<T, G>
impl<'a, T, G> IntoConcurrentIter<Item = T> for SplitVec<T, G>

They together imply that the split vectors for all growth strategies defined in this crate implement ConcurrentCollection.

This allows for creating concurrent iterators over references of items of the split vector that can be shared among threads.

Parallelization

This applies that the following is automatically implemented:

impl<'a, T, G> IntoParIter<Item = &'a T> for &'a SplitVec<T, G>
impl<'a, T, G> IntoParIter<Item = T> for SplitVec<T, G>

Or in brief, SplitVec<T, G>: ParallelizableCollection<Item = T>.

This means that the split vector can be used as the input source for all parallel computations defined by the ParIter. The benchmarks show that parallelization over the defined concurrent iterators is very efficient.

  • split_vec.par() returns a parallel iterator over references to its elements, and
  • split_vec.into_par() consumes the vector and returns a parallel iterator of the owned elements.

You may find demonstrations in demo_parallelization and bench_parallelization examples.