Simple succinct data structures
December 25, 2025 ยท View on GitHub
These structures are comparable to those in SDSL in performance and scalability. As the focus is on (relative) simplicity, ugly low-level optimizations are generally avoided.
Implemented functionality
Integer vectors
RawVector: A bit array that supports reading, writing, and appending 1-64 bits at a time. Implemented on top ofVec<u64>.RawVectorWriter: An append-only version ofRawVectorthat writes the structure directly to a file.RawVectorMapper: An immutable memory-mappedRawVector.
IntVector: A bit-packed vector of fixed-width integers implemented on top ofRawVector. Likesdsl::int_vectorbut also supports stack functionality.IntVectorWriter: An append-only version ofIntVectorthat writes the structure directly to a file. Like a subset ofsdsl::int_vector_buffer.IntVectorMapper: An immutable memory-mappedIntVector.
WaveletMatrix: An immutable vector of fixed-width integers. Similar tosdsl::wm_int.- Supports
rank(),inverse_select(),select(),predecessor(), andsuccessor()with each item value. - Iterators over all items and over items with a specified value.
- Implemented using a
BitVectorfor each level.
- Supports
RLWM: A run-length encoded immutable vector of fixed-width integers.- Supports
rank(),inverse_select(),select(),predecessor(), andsuccessor()with each item value. - Iterators over all items and over items with a specified value, with an option to iterate over runs of items.
- Implemented using a
RLVectorfor each level.
- Supports
Bitvectors
BitVector: A plain immutable bitvector.- Supports
rank(),rank_zero(),inverse_select(),select(),select_zero(),predecessor(), andsuccessor()queries using optional support structures. - Iterators over set bits, unset bits, and all bits.
- Implemented on top of
RawVector.
- Supports
RLVector: A run-length encoded bitvector.- Supports
rank(),rank_zero(),inverse_select(),select(),select_zero(),predecessor(), andsuccessor()queries. - Iterators over set bits and all bits.
- Space-efficient construction with
RLBuilder.
- Supports
SparseVector: An Elias-Fano encoded bitvector.- Supports
rank(),rank_zero(),inverse_select(),select(),select_zero(),predecessor(), andsuccessor()queries . - Iterators over set bits and all bits.
- Space-efficient construction with
SparseBuilder.
- Supports
Notes
- The included
.cargo/config.tomlsets the target CPU tonative. - This crate is designed for the x86_64 architecture with the BMI2 instruction set (Intel Haswell / AMD Excavator or later). Some operations may be slow without the POPCNT, LZCNT, TZCNT, and PDEP instructions.
- 64-bit ARM is also supported.
- Unix-like operating system is required for
mmap(), which is enabled with featurelibc. - Things may not work if the system is not little-endian or if
usizeis not 64-bit.