redish 0.5.1

A lightweight in-memory key-value database
Documentation
use criterion::{criterion_group, criterion_main, Criterion};
use std::hint::black_box;
use redish::tree::{CompressionConfig, CompressionType, Compressor};

fn benchmark_compression(c: &mut Criterion) {
    let test_data = b"This is a test string that should compress well.".repeat(100);

    let mut group = c.benchmark_group("compression");

    for compression_type in [CompressionType::Snappy, CompressionType::Lz4, CompressionType::Zstd] {
        let config = CompressionConfig::new(compression_type);
        let compressor = Compressor::new(config);

        group.bench_function(format!("{:?}", compression_type), |b| {
            b.iter(|| {
                let compressed = compressor.compress(black_box(&test_data)).unwrap();
                compressor.decompress(black_box(&compressed)).unwrap()
            })
        });
    }

    group.finish();
}

criterion_group!(benches, benchmark_compression);
criterion_main!(benches);