Expand description
A reader for efficient, repeated random access into an VarVec.
This module provides VarVecReader, a reusable reader that is designed to
optimize random access performance.
§Performance
A standard call to get is convenient, but it
creates and discards an internal bitstream reader for each call. When
performing many random lookups, this can introduce significant overhead.
VarVecReader avoids this by maintaining a persistent, reusable
reader instance. This amortizes the setup cost across multiple get operations,
making it ideal for access patterns where lookup indices are not known in
advance (e.g., graph traversals, pointer chasing).
For reading a predefined list of indices, get_many
is generally more efficient, as it can pre-sort the indices for a single
sequential scan.
Structs§
- VarVec
Reader - A stateful reader for a
VarVecthat provides fast random access.