svb

svb is a pure-Rust StreamVByte library covering all major codec variants for u16, u32, and u64 integers. Delta and zigzag encoding are composable layers on top. SIMD back-ends are available for x86-64 (SSSE3, AVX2) and AArch64 (NEON).

What is StreamVByte?

StreamVByte is a family of integer compression schemes that store values in a variable number of bytes. Rather than interleaving the control information with the data, StreamVByte places all control bytes in a separate stream. This layout makes SIMD-accelerated decode practical: a batch of control bytes can be loaded and shuffled in a single instruction, determining widths for an entire group of values without branching.

encoded buffer layout
┌────────────────────┬─────────────────────────────────────┐
│   control stream   │            data stream               │
│  ceil(n/4) bytes   │         variable length              │
└────────────────────┴─────────────────────────────────────┘

Each 2-bit tag in the control stream describes the byte width of the corresponding value. Four values share one control byte. The byte widths available depend on the codec variant.

Codec variants at a glance

VariantElementTag widthByte widthsBest for
Svb16u161 bit1/2ONT VBZ signal data
U32Classicu322 bits1/2/3/4General u32, C-library compatible
U32Variant0124u322 bits0/1/2/4Sparse u32 (many zeros)
U64Coder1234u642 bits1/2/3/4u64 values that fit in u32
U64Coder1248u642 bits1/2/4/8Full u64 range

API docs

Rustdoc API reference is published at docs.rs/svb.