compactly 0.1.7

Compactly encode data types using adaptive arithmetic coding
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn main() {
    // Use a simple LCG for reproducible pseudo-random data that stresses the branch predictor.
    let mut x = 0x123456789abcdef0u64;
    let data: Vec<u64> = (0..100000)
        .map(|_| {
            x = x.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
            x
        })
        .collect();
    let compressed = compactly::v2::Ans::encode(&data);
    let mut total_size = 0;
    for _ in 0..5000 {
        total_size += std::hint::black_box(compactly::v2::Ans::decode::<Vec<u64>>(&compressed))
            .unwrap()
            .len();
    }
    println!("total size is {total_size}?");
}