Files
craft-libs/crates/shared-vec/examples
dotCooCoo 464dcb71d7 craft-shared-vec: make small range edits as single edits
append, split_off, truncate, splice and retain rebuilt every branch
from the leaves, so removing one element of 100,000 through splice or
retain counted about 40 KB, against 2.8 KB for remove. They now make
their changes as single edits when they remove or insert only a few
elements, and rebuild only when the single edits could copy as many
blocks. Removing one element through splice or retain now counts the
same as remove.

- An empty list does not allocate: the root is None until the first
  element, so two empty lists hold no blocks and count 0 bytes.
- An insertion into a shared leaf copies it once, into a block with
  room for the new element, instead of copying and then reallocating.
- The leaf walk keeps 12 levels, and its comment states the size of
  the deepest tree it handles.
- The benchmark times only the edit on both sides, and says the bytes
  per edit are computed. The Vec times were inflated by the snapshot
  drop: 296 us per edit at 100,000 elements, not 579 us.
- The docs say what a block's bytes cover, and what a panicking
  T::clone leaves behind.
2026-11-22 10:08:20 -08:00
..