Skip to main content

A fast bloom filter implemented by Rust for Python!

Project description

fastbloom

A fast bloom filter implemented by Rust for Python!

benchmark

bloom add

PDF of Slope Regression

Additional Statistics:

Lower bound Estimate Upper bound
Slope 41.095 ns 41.146 ns 41.203 ns
0.9959495 0.9961648 0.9959083
Mean 41.157 ns 41.207 ns 41.257 ns
Std. Dev. 226.07 ps 261.59 ps 294.01 ps
Median 41.132 ns 41.184 ns 41.247 ns
MAD 201.13 ps 277.13 ps 335.05 ps

Python

requirements

Python >= 3.7

setup

Install the latest fastbloom version with:

pip install fastbloom-rs

Examples

for python

from fastbloom_rs import BloomFilter

bloom = BloomFilter(100_000_000, 0.01)

bloom.add_str('hello')
bloom.add_bytes(b'world')
bloom.add_int(9527)

assert bloom.contains('hello')
assert bloom.contains(b'world')
assert bloom.contains(9527)

assert not bloom.contains('hello world')

for rust

use fastbloom_rs::{BloomFilter, FilterBuilder};

let mut bloom = FilterBuilder::new(100_000_000, 0.01).build_bloom_filter();

bloom.add(b"helloworld");
assert_eq!(bloom.contains(b"helloworld"), true);
assert_eq!(bloom.contains(b"helloworld!"), false);

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastbloom_rs-0.1.1.tar.gz (39.1 kB view hashes)

Uploaded Source

Built Distributions

fastbloom_rs-0.1.1-cp37-abi3-win_amd64.whl (143.9 kB view hashes)

Uploaded CPython 3.7+ Windows x86-64

fastbloom_rs-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (198.9 kB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

fastbloom_rs-0.1.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (215.3 kB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ x86-64

fastbloom_rs-0.1.1-cp37-abi3-macosx_11_0_arm64.whl (185.7 kB view hashes)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

fastbloom_rs-0.1.1-cp37-abi3-macosx_10_7_x86_64.whl (197.0 kB view hashes)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page