Expand description
Persistent vectors with efficient clone, append and split operations with idiomatic Rust interface.
§Provided vector types
There are three public vector types available at pvec-rs:
- RbVec: based on RbTree with naive append and split operations. This type is not recommended for use, as it is here solely for comparison in benchmarks.
- RrbVec: based on RrbTree that enables efficient append and split operations.
- PVec: a persistent vector that starts out as the standard vec, and transitions to RrbVec on the first clone. The cost of its operations is identical to the representation it is backed by.
All vector types in the list expose exactly the same set of operations with identical API. The difference is only in the cost of operations.
§Features
RbVec and RrbVec
both use Rc
for garbage collection. The library provides an option to
compile all vectors using Arc
if needed, especially when passing instances between threads. To compile the
library with Arc, use
the arc
feature flag.
All types implement Rayon’s IntoParallelIterator trait,
that enables the conversion into a parallel iterator. As dependency on
Rayon is optional, you will need to explicitly request the parallel
iterator implementation by passing both the arc
and rayon_iter
feature flags.
By default, the tree-based vectors have nodes that are 32 elements wide. The
maximum number of child nodes is also referred to as the branching factor.
This value can be changed to 4 if necessary, by specifying the small_branch
feature flag. Though, the default value of 32 is recommended
for optimal performance.
Modules§
- A module providing persistent vector types based on RrbTree.
- A module providing implementation of the standard Iterator, as well as Rayon’s ParallelIterator if the
rayon_iter
feature flag is specified.
Structs§
- A persistent vector that is backed by the flat representation - the standard vector, or the tree-based vector when cloned.