bitpack-vec
A dense bitpacked vector type for unnsigned integers.
use BitpackVec;
let mut bv = new; // 5-bit integers
for i in 0..12
assert_eq!;
assert_eq!;
use DeepSizeOf;
assert_eq!; // underlying vector length is just 1 (60 bits)
// total in-memory size (not strictly specified by Rust):
assert_eq!;
O(1)random access to single elementsO(1)popO(1)set- Amortized
O(1)push (same as RustVec) - Any bitlength from 1 to 63
- Serde serializable
This package does an "as you'd expect" bitpacking of integers, with no fancy SIMD or additional compression. Values are stored in a Vec<u64>, so no more than 63 bits should be wasted. Values can overlap u64 values.
Compared to other bitpacking packages for Rust:
bitpackinguses SIMD compression to pack values into blocks, but entire blocks must be decompressed in order to access values. If you don't care about random access,bitpackingis probably what you want.vorbis_bitpackallows for streaming compression and decompression of packed integers, using the Vorbis format. No random access, but has streaming readers / writers.parquetimplements a number of Apache-backed formats (feather, arrow, parquet), many of which support bitpacking and other types of compression.
License
This code is available under the terms of the GPL-3.0 (or later) license.