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.1.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.1-cp38-abi3-win_amd64.whl (171.4 kB view details)

Uploaded CPython 3.8+Windows x86-64

binaryfuse-0.1.1-cp38-abi3-win32.whl (163.5 kB view details)

Uploaded CPython 3.8+Windows x86

binaryfuse-0.1.1-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.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (334.1 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

binaryfuse-0.1.1-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.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (298.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (285.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

binaryfuse-0.1.1-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.1-cp38-abi3-macosx_11_0_arm64.whl (261.5 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

binaryfuse-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl (273.1 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: binaryfuse-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 cdc5c1174dd88a6b5858d3c6886a61b83d391120bd309cfe902fed3211cae659
MD5 ec3d8e8540b294f8bff7408f23598b3a
BLAKE2b-256 300c4360c500f02e24bf6137ba6824cc96ddeaddaaf9712d77dbf06d917da4a7

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: binaryfuse-0.1.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 171.4 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.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c5cc2cd525b417d43906f4ebdcc8d6d7783175144ff143d0d6033279279dfd3f
MD5 a17322d59412c23510e4dc11323899df
BLAKE2b-256 42dc16898dea52171c9812189822282a8b6f4a8ffbad495cb81c39686aa3773d

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-win32.whl.

File metadata

  • Download URL: binaryfuse-0.1.1-cp38-abi3-win32.whl
  • Upload date:
  • Size: 163.5 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.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 b1c92dad2bd24453f070e8e76c95190f9ca7d039f06c9dafb736071a40c73be8
MD5 eb9d5949a7d7c339c78bdb56c7d0984f
BLAKE2b-256 23d68fed0577cd4559a5a3194ed2484d5f3e96eb6877cb18988b180d93349ab5

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4fca00c743cf30ebaaf0a99c1cbca0b1ad146d85028ceff861685e02bb8dd0e9
MD5 5dc6b3e755fb067c2d582dac8870b8de
BLAKE2b-256 e8d4ad5e33da107dfc3bb80b3e0f602727d687d3b44f0663139a8164bab13648

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1c38d7fe2ec2d393cd4e25f228df2f70c50c23fb83d96635023b37e65a4008c6
MD5 f53a7f3ab2f90de7015e35eead7c41a6
BLAKE2b-256 4390b3c5d8c560966779778a376ad475582ea762fec4f685c33b1c52889575a9

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e8ebd56af801cc584cbf497bb5712bd5d96316bc8da7c5c26a9ecdc36136f21f
MD5 081827fa45d4424697c4ab7a4ff262d5
BLAKE2b-256 5e48f566122bac4cbebd9022fee3fddee52e74d6a8abf0861ccdbab164590769

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 03dafe67a4ba1444ecd544873f537482f0989052d8f01c174be7ffb6a0270237
MD5 9dca936ce9eab5f2e3a46b061ce5e622
BLAKE2b-256 d913915f380c86561cc7c2da6856cd4864fad7edebaee4dcd8c49d1ab295b444

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d2bd52b865f8da9c351d3acc2bbee38797780b1532c6c3c600bf03a44ac3d8b2
MD5 11ce34a6fe0f9754db59bc56c03ddab0
BLAKE2b-256 e459adb705d27b796d392d8cc937e62caf66748b904a87ccd5fab09ae8eb8a12

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 992b026414d554f10b89006f106bfc0f37d229cdb31a71da597b8fd39fcbdc5d
MD5 24bd7d11d8f48c16902830ebb43658c9
BLAKE2b-256 9ab1120838b3e01ae413b5c95eb8f0d118560d5ac8036c1ab65f76f2383a4589

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14f60a862dc9aaa725e44af4dbd1424adda788e2f37d358dca23b00830279603
MD5 7ff2e64365f807e0c175d0adf8f9a673
BLAKE2b-256 ab5b9b9f4fca4af8836fdfa24ad681ff2fab2e143edbb4a32b31645c133d3428

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for binaryfuse-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 408774ebfe24b8ebc3a273732e5c736db4fd00e7d22545caaa37cd0614069a61
MD5 940c4275b8f2060059fb61b0b5312ad6
BLAKE2b-256 8cc74b02dbaa16b7a3847e824c04eba7ce57de11ac970a61cb66ff32a63986a1

See more details on using hashes here.

Provenance

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

Publisher: CI.yml on NivekNey/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