Bloom filter library implemented in Rust with Python bindings
Project description
kathir-bloom-filter
A super simple and fast Bloom filter implementation in Rust with Python bindings.
Installation
pip install kathir-bloom-filter
Usage
from kathir_bloom_filter import BloomFilter
# Create a Bloom filter for ~1 million items with 1% false positive rate
bf = BloomFilter(expected_items=1_000_000, false_positive_rate=0.01)
# Insert items (strings, ints, or any hashable type)
bf.insert("hello")
bf.insert(42)
# Check membership
"hello" in bf # True
"world" in bf # False (might incorrectly report True with probability = false_positive_rate)
Performance
Benchmarked against other Python Bloom filter libraries on 1M random item insertions and queries with various item types and patterns (see https://github.com/kathirmeyyappan/bloom-filter-bench).
Overall, we can see that for the simple cases, this bloom filter performs MUCH better than "standard" Python implementations and marginally better than some other libraries.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kathir_bloom_filter-0.1.1.tar.gz.
File metadata
- Download URL: kathir_bloom_filter-0.1.1.tar.gz
- Upload date:
- Size: 131.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e60892750fb225122162fc198eb3327f02ba2ead2d451e4b7bd2f0ebe7fe717
|
|
| MD5 |
417c15d016ecdbf88b810ddfcd0fb682
|
|
| BLAKE2b-256 |
1d3b8df88a30d01ce9a2c50c47aa4424ed1876e167fc70d869a8293ae5f5350c
|
File details
Details for the file kathir_bloom_filter-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: kathir_bloom_filter-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 262.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0528bbac5c47e32552396ea6326c0d27034f9e47e62ca8158f48e2add58e2d12
|
|
| MD5 |
b8cc60ee57247f6618c7e0dec9bd0f5a
|
|
| BLAKE2b-256 |
3b2bd8311584792a949ed0a2139ca359ee65ba958afff7fa587afee03bc27ca6
|