{"id":22976807,"url":"https://github.com/arpitbbhayani/abloom","last_synced_at":"2025-08-13T16:32:04.639Z","repository":{"id":73708800,"uuid":"554004946","full_name":"arpitbbhayani/abloom","owner":"arpitbbhayani","description":"A pure Go implementation of Bloom Filter.","archived":false,"fork":false,"pushed_at":"2022-11-13T16:06:21.000Z","size":38,"stargazers_count":37,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-21T19:08:42.505Z","etag":null,"topics":["bloom-filter"],"latest_commit_sha":null,"homepage":"","language":"Go","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/arpitbbhayani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-10-19T05:12:12.000Z","updated_at":"2024-06-11T05:53:01.000Z","dependencies_parsed_at":"2023-02-27T06:45:46.814Z","dependency_job_id":null,"html_url":"https://github.com/arpitbbhayani/abloom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpitbbhayani%2Fabloom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpitbbhayani%2Fabloom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpitbbhayani%2Fabloom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpitbbhayani%2Fabloom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arpitbbhayani","download_url":"https://codeload.github.com/arpitbbhayani/abloom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229770428,"owners_count":18121595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-filter"],"created_at":"2024-12-15T00:56:29.113Z","updated_at":"2024-12-15T00:56:29.637Z","avatar_url":"https://github.com/arpitbbhayani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"abloom\n===\n\n`abloom` is a pure Go implementation of Bloom Filter. The implementation supports the following\nBloom Filters\n\n- Simple Bloom Filter\n- Deletable Bloom Filter\n\n## Installation\n\n```\n$ go get github.com/arpitbbhayani/abloom\n```\n\n## How to use\n\nA simple example of using bloom filter is as shown below. More examples can be found\nin the [examples directory](https://github.com/arpitbbhayani/abloom/tree/master/examples/) of the package.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/arpitbbhayani/abloom\"\n)\n\nfunc main() {\n\tb := abloom.NewSimpleBF(512, nil)\n\tb.Put([]byte(\"apple\"))\n\tb.Put([]byte(\"banana\"))\n\tb.Put([]byte(\"cat\"))\n\n\tv, err := b.Check([]byte(\"apple\"))\n\tif err != nil {\n\t\tlog.Fatal(\"error while computing the hash\")\n\t}\n\tlog.Println(\"is apple present?\", v)\n}\n```\n\n## Running Tests\n\nTo run all the tests fire the following command\n\n```sh\n$ go test ./...\n```\n\n## Behaviour\n\nThe behaviour of bloom filter on various parameters is evalated\non the usecase of profanity detector as documented in the\n[examples directory](https://github.com/arpitbbhayani/abloom/tree/master/examples/profanity-detector). Please look at the source code to understand\nwhat and how we have benchmarked.\n\n### Bloom Filter Size vs False Positive Rate\n\nWe can see how the size of bloom filter is related to the observed false\npositivity rate. Larger the size, smaller the false positivity rate.\n\n![size-fp](https://user-images.githubusercontent.com/4745789/200518788-d545bc41-425b-47bf-a609-33b3a9ade34a.png)\n\n### Number of Hash Functions vs False Positive Rate and Time\n\nHere we see how the number of hash functions used in a bloom filter\naffects the false positivity rate and also time. The FP rate decreases\ninitially but after a certain stage it saturates and then increases.\n\nThe time takes for the operation increases almost linearly with the\nnumber of hash functions given how expensive hash computation can get.\n\n![hash-fp](https://user-images.githubusercontent.com/4745789/200518773-76631419-a909-408e-9063-08a366218da2.png)\n![hash-time](https://user-images.githubusercontent.com/4745789/200518783-835411e1-838e-4587-8b54-1de0acb54ca1.png)\n\n### Deletable Bloom Filter Number of Regions vs False Positive Rate\n\n![dbf-region](https://user-images.githubusercontent.com/4745789/200841018-dffcbeb3-d6be-43f8-a8da-e29ef28698a2.png)\n\n### When not to use BF\n\n![paradox-benchmark](https://user-images.githubusercontent.com/4745789/201531618-1a736e49-3927-4f86-b60e-4a810fa69d90.png)\n\n## Benchmark\n\nPreliminary benchmark results on [profanity usecase](https://github.com/arpitbbhayani/abloom/tree/master/examples/perftest) are shown below. Please refer to the perf test code to see what has been\ntested and benchmarked.\n\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/arpitbbhayani/abloom/examples/perftest\ncpu: AMD Ryzen 7 4800U with Radeon Graphics         \nBenchmarkBFCheck-16                          381           3172999 ns/op\nBenchmarkBFFirstCheck-16                20828637                51.24 ns/op\nBenchmarkBFOneRandomCheck-16            11330626               112.2 ns/op\nBenchmarkSetCheck-16                         230           4906682 ns/op\nBenchmarkSetFirstCheck-16               82293306                14.12 ns/op\nBenchmarkSetOneRandomCheck-16            6412029               178.6 ns/op\n```\n\n## Citations\n\n- Bloom, Burton H. “Space/Time Trade-Offs in Hash Coding with Allowable Errors.” Communications of the ACM 13, no. 7 (July 1970): 422–26. https://doi.org/10.1145/362686.362692.\n- Rothenberg, Christian Esteve, Carlos A. B. Macapuna, Fabio L. Verdi, and Mauricio F. Magalhaes. “The Deletable Bloom Filter: A New Member of the Bloom Family.” arXiv, May 3, 2010. http://arxiv.org/abs/1005.0352.\n\n## Contributors\n\n\u003ca href = \"https://github.com/arpitbbhayani/abloom/graphs/contributors\"\u003e\n  \u003cimg src = \"https://contrib.rocks/image?repo=arpitbbhayani/abloom\"/\u003e\n\u003c/a\u003e\n\n## License\n\nAbloom is open-sourced under [Apache License, Version 2.0](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farpitbbhayani%2Fabloom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farpitbbhayani%2Fabloom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farpitbbhayani%2Fabloom/lists"}