Skip to main content

A fast and space-efficient Binary Fuse Filter implementation with Python bindings.

Project description

Binary Fuse Filter

A fast and space-efficient Binary Fuse Filter implementation in Rust with Python bindings. Based on the paper "Binary Fuse Filters: Fast and Smaller Than Xor Filters" by Daniel Lemire et al.

Binary Fuse Filters are approximate set membership structures (like Bloom filters) but are smaller and faster for lookups. They are particularly effective when the set of keys is known in advance (static filters).

Features

  • High Performance: Implementation in Rust for maximum speed.
  • Space Efficient: Only ~1.15x overhead over the theoretical minimum (better than Bloom/Xor filters).
  • Python Bindings: Easy to use from Python with BinaryFuse8 (8-bit fingerprints, ~0.4% FPR) and BinaryFuse16 (16-bit fingerprints, ~0.0015% FPR).
  • Serialization: Full support for Python's pickle module.

Installation

pip install binaryfuse

Usage (Python)

from binary_fuse import BinaryFuse8

# List of integer keys
keys = [1, 2, 3, 100, 200, 300]

# Build the filter
bf = BinaryFuse8(keys)

# Check membership
print(1 in bf)    # True
print(101 in bf)  # False (most likely)

# Serialization
import pickle
data = pickle.dumps(bf)
bf2 = pickle.loads(data)
print(1 in bf2)   # True

Compatibility & Zero-Compile Installation

We ship abi3 wheels (Stable ABI), which means:

  • One binary works everywhere: A single wheel supports all Python versions from 3.8 to 3.13+.
  • No compilation needed: Works out-of-the-box on Linux (glibc/musl), macOS (Intel/Apple Silicon), and Windows.
  • Future-proof: The wheel you install today will likely work on Python 3.14+ without any updates.

Technical Details

Binary Fuse Filters use a fused segment layout where each key is mapped to three locations ($h_0, h_1, h_2$) in a linear array. The locations are chosen from overlapping segments, which improves the success rate of the construction algorithm compared to standard Xor filters.

This implementation uses:

  • Arity 3: Each key maps to 3 locations.
  • 32 Segments: Standard for modern Binary Fuse Filter implementations.
  • Hashing: Robust mixing of 64-bit hashes to ensure uniform distribution.

Comparative Results (100,000 keys)

Filter Build (s) Hit (s) Miss (s) FPR (%) Size (KB) Bits/Key
BinaryFuse8 (Ours) 0.0170 0.0029 0.0032 0.37% 131.0 10.7
BinaryFuse16 (Ours) 0.0132 0.0029 0.0030 0.00% 262.0 21.4
rbloom (Rust Bloom) 0.0053 0.0019 0.0026 1.00% 117.0 9.6
Fuse8 (Lemire C) 0.0195 0.0203 0.0206 0.40% 1056.0* N/A
pybloom-live (Py) 0.0915 0.0829 0.0602 0.99% 117.3 9.6

* Note: Some C-binding sizes (like Fuse8) are estimated via RSS delta and may be inaccurate.

Why use Binary Fuse Filter?

While standard Bloom filters (like rbloom) are slightly faster for lookups (~20ns vs ~30ns), Binary Fuse Filters are significantly more space-efficient for the same accuracy.

  • Accuracy vs Size: For roughly the same memory (~120-130KB), our BinaryFuse8 offers 0.37% False Positive Rate, while the Bloom filter has 1.00% error. You get 2.7x better accuracy for the same cost.
  • To match our accuracy: A Bloom filter would need ~11.5 bits/key, making it ~20% larger than our filter.
  • Immutability: Binary Fuse filters are static. If you need to add items incrementally, use a Bloom filter. If you have a static dataset (e.g., a daily blocklist, a dictionary), Binary Fuse is mathematically superior.

Thread Safety

Our implementation is thread-safe for concurrent lookups. Because the filter is immutable after construction, multiple Python threads can perform membership tests (key in bf) simultaneously. The underlying Rust logic does not require any write locks or synchronization, making it ideal for high-concurrency environments.

License

MIT

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

binaryfuse-0.1.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

binaryfuse-0.1.2-cp38-abi3-win_amd64.whl (168.1 kB view details)

Uploaded CPython 3.8+Windows x86-64

binaryfuse-0.1.2-cp38-abi3-win32.whl (162.0 kB view details)

Uploaded CPython 3.8+Windows x86

binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (288.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (334.0 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (318.3 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (298.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (285.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

binaryfuse-0.1.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (310.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

binaryfuse-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (262.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

binaryfuse-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl (271.9 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file binaryfuse-0.1.2.tar.gz.

File metadata

  • Download URL: binaryfuse-0.1.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binaryfuse-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bd8ee2838bdc2cd2a288a27de8973393ab73ecc1a98fde67e03c3f6ba525882b
MD5 b8f49b82b0302cce129691df3f210ad2
BLAKE2b-256 3fb791c6bc0df6107e0db543c564758f922fb5075d0ae89381f54621e3e5c5c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2.tar.gz:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: binaryfuse-0.1.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 168.1 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9dbc8bf28b2a2b2d9463c651a23274ff7aa24017b4d47f9f37af9de1075e6ad1
MD5 a1ca85919cb77d384c9feda08f93061a
BLAKE2b-256 65ce35ebf4e9e8a15c8679f72ff1c9d7db353807e8f18d281b19703cbaf3b3a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-win_amd64.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-win32.whl.

File metadata

  • Download URL: binaryfuse-0.1.2-cp38-abi3-win32.whl
  • Upload date:
  • Size: 162.0 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 ac26672c21a2ab2e2cdef3c4ee06b67aec8d1d91c76437fae547109c1e26791a
MD5 3bd43ffe0e111b1db5ae3d0d942c0382
BLAKE2b-256 1a710cc90f2eab14985f95858ff1b7f543e3f600b5e9778ab2df1eda1b0d3a04

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-win32.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d75945d088fd471fbc1cf7a70809fdb99d8072addc94ce5188a6f5de9e3d723
MD5 4c9782f538eaf7e8a0650d3d61ccf30d
BLAKE2b-256 5a02ad761013120e66b1897048c3d11a96fd23d4a61f22e6f7be177b1d90d55e

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 66ec17cbfec3ece3bf757a5b1f8ff0c6b972ef3b446203753e27518c62b21d1b
MD5 d8169508ecb59ee1829efc97f6e8867a
BLAKE2b-256 d30fbd21bcb2a119e241a11ebb53faf9fe2cd0558bdb667f072a6ef20ad56edd

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 69ad95350a8b4e81b27243aeef5447c2a7d5a7d14cf59c78d6e69aa90baf76c7
MD5 6fd161a5d72a12f7611a56770826c560
BLAKE2b-256 c49f1eb35d600b410165ac8c1f001dfd44022a8eae12726813e8a3b993b32a3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 30b927d929b920cf3c83d4af19e0db67aa196da1b42d092242d1de80d6720dcd
MD5 1bea163bd9f3eadf188f9b285725fe2d
BLAKE2b-256 4d690914c18921d75196d0d43f2e53f8dac436b231ee42d10ab9aca93ae79d1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05789af3bf6749e830f9abb1dea7a3badc9003319c1c4baaa5bd4547aad1cc9f
MD5 2aa34ba3613f24efb85b4820ef271a77
BLAKE2b-256 35bddd4ab51e56ce386241b47626d2f90564a0a969d03c765133cd607352ac70

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 ee5c958c2a2824b2536615ab9a9300e759508945117a2399006c510abebd09af
MD5 13f3f7295f5657556ceb8f453964e5bf
BLAKE2b-256 db0dc2c5e036880a5a19ea42cbe4d97e92be60dd115a1e2de327e6a473d08aad

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c525f31a493d53cccc48554574a9e219d77c2c547ca0f9415655b8052e5265f3
MD5 8ec07a98ffaa2ee338b0a3220d0ef8e0
BLAKE2b-256 49a13df35c369d356dc1c40ecbe75b3fad0c7560577c6af62a7ef23ff71200a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binaryfuse-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b53010d30604355e5a0350c357c885e6f85e5110d98934484733fb069f681cd0
MD5 467820448538fa38a41f54142a144606
BLAKE2b-256 7fe7848d044d6cded70a251f862a2faff6d5c37118bd1aeeb992d15b41a2ca09

See more details on using hashes here.

Provenance

The following attestation bundles were made for binaryfuse-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on HolosStack/binaryfuse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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