pithanos

Crates.iopithanos
lib.rspithanos
version0.2.0
created_at2025-10-26 20:57:25.607265+00
updated_at2025-12-08 00:13:50.954893+00
descriptionFast, lock-free probabilistic data structures for modern Rust.
homepagehttps://github.com/Pranish-Pantha/pithanos
repositoryhttps://github.com/Pranish-Pantha/pithanos
max_upload_size
id1901865
size45,202
Pranish Pantha (Pranish-Pantha)

documentation

README

🎯 Pithanos

Crates.io License: MIT

⚡ Fast, lock-free probabilistic data structures for modern Rust. Includes Bloom Filter and Count-Min Sketch implementations optimized for speed and concurrency.


✨ Features

Feature Description
🧩 Bloom Filter Approximate set membership check
📊 Count-Min Sketch Approximate frequency estimation
⚙️ No global locks Thread-safe access with atomic operations, fast deterministic hashing (xxhash)
📦 Modular design Shared internal traits and utilities, clean module structure
🧪 Benchmark suite Criterion-based microbenchmarks for queries

📦 Installation

Add this to your Cargo.toml:

[dependencies]
pithanos = "0.1"

🚀 Quick Start

Bloom Filter

use pithanos::bloom::BloomFilter;

fn main() {
    let filter = BloomFilter::new(1000, 3); // 1000 bits, 3 hash functions

    filter.insert(&"foo");
    filter.insert(&"bar");

    assert!(filter.contains(&"foo"));
    assert!(!filter.contains(&"bar"));
}

Count-Min Sketch

use pithanos::cms::CountMinSketch;

fn main() {
    let cms = CountMinSketch::new(1000, 3); // wdith 100, depth 3

    cms.increment(&"foo", 3);
    cms.increment(&"bar", 1);

    println!("Frequency of 'foo': {}", cms.frequency(&"foo"));
    println!("Frequency of 'bar': {}", cms.frequency(&"bar"));
}

🧪 Benchmarks

Pithanos uses criterion for micro-benchmarks.

Run all benchmarks with cargo bench

💬 Acknowledgments

Pithanos (πιθανός) — Ancient Greek: “likely,” “probable,” or “plausible.”

Inspired by RedisBloom

Commit count: 0

cargo fmt