Files
craft-libs/crates/shared-vec/examples
dotCooCoo fb66ff092e Add craft-shared-vec: an indexed list whose clones share their blocks
A document tree that keeps each container's children in an Arc<Vec<_>>
and edits them with Arc::make_mut copies the whole child list on every
edit while an undo snapshot still holds it. One edit on a layer of
100,000 objects copies 800 KB of handles.

SharedVec<T> keeps elements in leaves of up to 64 under a counted
B-tree with Arc blocks. get, set, get_mut, insert, remove, push and pop
take O(log n) and copy only the blocks on their path; append,
split_off, truncate, splice and retain rebuild the branches and keep
every leaf they do not change. bytes_not_in and bytes_not_in_with count
the blocks and element payloads one list holds and another does not,
for undo-history limits. With the serde feature a list reads and writes
as a plain sequence, the same bytes as a Vec.

The examples/bench.rs example times edits beside a kept snapshot and
iteration against Vec.
2026-11-22 09:49:02 -08:00
..