boxcar
A concurrent, append-only vector.
The vector provided by this crate suports concurrent get and push operations.
Reads are always lock-free, as are writes except when resizing is required.
Examples
Appending an element to a vector and retrieving it:
let vec = new;
vec.push;
assert_eq!;
The vector can be shared across threads with an Arc:
use Arc;
Elements can be mutated through fine-grained locking:
use ;
Performance
Below is a benchmark in which an increasing number of elements are pushed and read from the vector
by 12 threads, comparing boxcar::Vec to RwLock<Vec>:
The results show that boxcar::Vec scales very well under load, performing significantly better
than lock-based solutions.