{"id":39584730,"url":"https://github.com/tomtomwombat/fastbloom","last_synced_at":"2026-01-26T15:01:15.613Z","repository":{"id":223979118,"uuid":"762073151","full_name":"tomtomwombat/fastbloom","owner":"tomtomwombat","description":"The fastest Bloom filter in Rust. No accuracy compromises. Full concurrency support and compatible with any hasher.","archived":false,"fork":false,"pushed_at":"2026-01-24T05:51:24.000Z","size":343,"stargazers_count":324,"open_issues_count":3,"forks_count":23,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-24T14:23:40.706Z","etag":null,"topics":["bloom","bloom-filter","bloomfilter","filter","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomtomwombat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-23T03:02:49.000Z","updated_at":"2026-01-24T05:51:28.000Z","dependencies_parsed_at":"2024-02-29T04:26:43.375Z","dependency_job_id":"5e660a46-f3f7-404c-86dc-1f704261f87d","html_url":"https://github.com/tomtomwombat/fastbloom","commit_stats":null,"previous_names":["tomtomwombat/fastbloom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomtomwombat/fastbloom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtomwombat%2Ffastbloom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtomwombat%2Ffastbloom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtomwombat%2Ffastbloom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtomwombat%2Ffastbloom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomtomwombat","download_url":"https://codeload.github.com/tomtomwombat/fastbloom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtomwombat%2Ffastbloom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28781308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bloom","bloom-filter","bloomfilter","filter","rust"],"created_at":"2026-01-18T07:35:27.099Z","updated_at":"2026-01-26T15:01:15.608Z","avatar_url":"https://github.com/tomtomwombat.png","language":"Rust","readme":"# fastbloom\n[![Github](https://img.shields.io/badge/github-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github)](https://github.com/tomtomwombat/fastbloom)\n[![Crates.io](https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge\u0026labelColor=555555\u0026logo=rust)](https://crates.io/crates/fastbloom)\n[![docs.rs](https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs)](https://docs.rs/fastbloom)\n![Downloads](https://img.shields.io/crates/d/fastbloom?style=for-the-badge)\n\nThe fastest Bloom filter in Rust. No accuracy compromises. Full concurrency support and compatible with any hasher.\n\n## Overview\n\nfastbloom is a fast, flexible, and accurate Bloom filter implemented in Rust. fastbloom's default hasher is SipHash-1-3 using randomized keys but can be seeded or configured to use any hasher. fastbloom is 2-20 times faster and magnitudes more accurate than existing Bloom filter implementations. fastbloom's `AtomicBloomFilter` is a concurrent Bloom filter that avoids lock contention.\n\n## Usage\n\nDue to a different (improved!) algorithm in 0.15.x, Bloomfilters have incompatible serialization/deserialization with prior versions.\n\n```toml\n# Cargo.toml\n[dependencies]\nfastbloom = \"0.15.0\"\n```\nBasic usage:\n```rust\nuse fastbloom::BloomFilter;\n\nlet mut filter = BloomFilter::with_num_bits(1024).expected_items(2);\nfilter.insert(\"42\");\nfilter.insert(\"🦀\");\n```\nInstantiate with a target false positive rate:\n```rust\nuse fastbloom::BloomFilter;\n\nlet filter = BloomFilter::with_false_pos(0.001).items([\"42\", \"🦀\"]);\nassert!(filter.contains(\"42\"));\nassert!(filter.contains(\"🦀\"));\n```\nUse any hasher:\n```rust\nuse fastbloom::BloomFilter;\nuse foldhash::fast::RandomState;\n\nlet filter = BloomFilter::with_num_bits(1024)\n    .hasher(RandomState::default())\n    .items([\"42\", \"🦀\"]);\n```\nFull concurrency support. `AtomicBloomFilter` is a drop-in replacement for `RwLock\u003cOtherBloomFilter\u003e` because all methods take `\u0026self`:\n```rust\nuse fastbloom::AtomicBloomFilter;\n\nlet filter = AtomicBloomFilter::with_num_bits(1024).expected_items(2);\nfilter.insert(\"42\");\nfilter.insert(\"🦀\");\n```\n\n## Background\nBloom filters are space-efficient approximate membership set data structures supported by an underlying bit array to track item membership. To insert/check membership, a number of bits are set/checked at positions based on the item's hash. False positives from a membership check are possible, but false negatives are not. Once constructed, neither the Bloom filter's underlying memory usage nor number of bits per item change. [See more.](https://en.wikipedia.org/wiki/Bloom_filter)\n\n```text\nhash(4) ──────┬─────┬───────────────┐\n              ↓     ↓               ↓\n0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0\n  ↑           ↑           ↑\n  └───────────┴───────────┴──── hash(3) (not in the set)\n```\n\n## Implementation\n\nfastbloom is blazingly fast because it efficiently derives many index bits from **only one real hash per item** and leverages other research findings on Bloom filters. fastbloom employs \"hash composition\" on two 32-bit halves of an original 64-bit hash. Each subsequent hash is derived by combining the original hash value with a different constant using modular arithmetic and bitwise operations. This results in a set of hash functions that are effectively independent and uniformly distributed, even though they are derived from the same original hash function. Computing the composition of two original hashes is faster than re-computing the hash with a different seed. This technique is [explained in depth in this paper.](https://www.eecs.harvard.edu/~michaelm/postscripts/rsa2008.pdf)\n\n## Speed\n- AMD Ryzen 9 5900X 12-Core Processor             (3.70 GHz)\n- 64-bit operating system, x64-based processor\n\n![perf-non-member](https://github.com/user-attachments/assets/a825d2f7-4cd7-4b6b-a447-fd7f3dab356b)\n![perf-member](https://github.com/user-attachments/assets/998f9470-b91f-460c-ad2d-1f197160c210)\n\u003e Hashers used:\n\u003e - xxhash: sbbf\n\u003e - Sip1-3: bloom, bloomfilter, probabilistic-collections\n\u003e - foldhash: fastbloom\n\u003e \n\u003e [Benchmark source](https://github.com/tomtomwombat/bench-bloom-filters)\n\n## Accuracy\n\nfastbloom does not compromise accuracy. Below is a comparison of false positive rates with other Bloom filter crates:\n\n![fp](https://github.com/user-attachments/assets/17ddaab7-c63f-456a-9e2e-b22c7f994386)\n\n[Benchmark source](https://github.com/tomtomwombat/bench-bloom-filters)\n\n## Available Features\n\n- **`rand`** - Enabled by default, this has the `DefaultHasher` source its random state using `thread_rng()` instead of hardware sources. Getting entropy from a user-space source is considerably faster, but requires additional dependencies to achieve this. Disabling this feature by using `default-features = false` makes `DefaultHasher` source its entropy using `getrandom`, which will have a much simpler code footprint at the expense of speed.\n- **`serde`** - `BloomFilter`s implement `Serialize` and `Deserialize` when possible.\n- **`loom`** - `AtomicBloomFilter`s use [loom](https://github.com/tokio-rs/loom) atomics, making it compatible with loom testing.\n\n## References\n- [Bloom filter - Wikipedia](https://en.wikipedia.org/wiki/Bloom_filter)\n- [Bloom filters debunked: Dispelling 30 Years of bad math with Coq!](https://gopiandcode.uk/logs/log-bloomfilters-debunked.html)\n- [Bloom Filter Interactive Demonstration](https://www.jasondavies.com/bloomfilter/)\n- [Cache-, Hash- and Space-Efficient Bloom Filters](https://web.archive.org/web/20070623102632/http://algo2.iti.uni-karlsruhe.de/singler/publications/cacheefficientbloomfilters-wea2007.pdf)\n- [Less hashing, same performance: Building a better Bloom filter](https://www.eecs.harvard.edu/~michaelm/postscripts/rsa2008.pdf)\n- [A fast alternative to the modulo reduction](https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/)\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":["\u003ca name=\"Rust\"\u003e\u003c/a\u003eRust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtomwombat%2Ffastbloom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomtomwombat%2Ffastbloom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtomwombat%2Ffastbloom/lists"}