Skip to main content

Module bitpack

Module bitpack 

Source
Expand description

Bit-packing for small integers.

Bit-packing stores integers using only the minimum number of bits required to represent the largest value. This is especially effective when combined with delta encoding, where deltas are typically small.

§Example

// Values: [5, 2, 3, 5, 5, 8, 2] - max is 8, needs 4 bits
// Normal: 7 * 64 = 448 bits
// Packed: 7 * 4 = 28 bits (16x compression)

let values = vec![5u64, 2, 3, 5, 5, 8, 2];
let packed = BitPackedInts::pack(&values);
let unpacked = packed.unpack();
assert_eq!(values, unpacked);

Structs§

BitPackedInts
Bit-packed integer array.
DeltaBitPacked
Delta + bit-packed encoding for sorted integers.