{"id":13411437,"url":"https://github.com/OldPanda/bloomfilter","last_synced_at":"2025-03-14T17:30:51.360Z","repository":{"id":44419225,"uuid":"325899531","full_name":"OldPanda/bloomfilter","owner":"OldPanda","description":"Yet another Bloomfilter implementation in Go, compatible with Java's Guava library","archived":false,"fork":false,"pushed_at":"2023-02-16T03:55:05.000Z","size":38,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-01T13:41:51.646Z","etag":null,"topics":["bloomfilter","bloomfilter-go","golang","golang-library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OldPanda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-01-01T01:28:04.000Z","updated_at":"2024-03-05T07:29:41.000Z","dependencies_parsed_at":"2024-01-07T22:03:58.746Z","dependency_job_id":null,"html_url":"https://github.com/OldPanda/bloomfilter","commit_stats":null,"previous_names":["oldpanda/bloomfilter-go"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldPanda%2Fbloomfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldPanda%2Fbloomfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldPanda%2Fbloomfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OldPanda%2Fbloomfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OldPanda","download_url":"https://codeload.github.com/OldPanda/bloomfilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618630,"owners_count":20320268,"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":["bloomfilter","bloomfilter-go","golang","golang-library"],"created_at":"2024-07-30T20:01:13.656Z","updated_at":"2025-03-14T17:30:51.064Z","avatar_url":"https://github.com/OldPanda.png","language":"Go","readme":"# bloomfilter\n\n![Build](https://github.com/OldPanda/bloomfilter/actions/workflows/build.yml/badge.svg)\n[![codecov](https://codecov.io/gh/OldPanda/bloomfilter/branch/master/graph/badge.svg?token=FCV788SCL7)](https://codecov.io/gh/OldPanda/bloomfilter)\n[![Go Reference](https://pkg.go.dev/badge/github.com/OldPanda/bloomfilter.svg)](https://pkg.go.dev/github.com/OldPanda/bloomfilter)\n[![Go Report Card](https://goreportcard.com/badge/github.com/OldPanda/bloomfilter)](https://goreportcard.com/report/github.com/OldPanda/bloomfilter)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)\n\n## Overview\n\nYet another Bloomfilter implementation in Go, compatible with Java's Guava library. This library borrows how [Java's Guava libraray](https://guava.dev/) implements Bloomfilter hashing strategies to achieve the serialization compatibility.\n\n## Installing\n\nFirst pull the latest version of the library:\n\n```\ngo get github.com/OldPanda/bloomfilter\n```\n\nThen import the this library in your code:\n\n```\nimport \"github.com/OldPanda/bloomfilter\"\n```\n\n## Usage Examples\n\n### Basic Usage\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/OldPanda/bloomfilter\"\n)\n\nfunc main() {\n\t// create bloomfilter with expected insertion=500, error rate=0.01\n\tbf, _ := bloomfilter.NewBloomFilter(500, 0.01)\n\t// add number 0~199 into bloomfilter\n\tfor i := 0; i \u003c 200; i++ {\n\t\tbf.Put(i)\n\t}\n\n\t// check if number 100 and 200 are in bloomfilter\n\tfmt.Println(bf.MightContain(100))\n\tfmt.Println(bf.MightContain(200))\n}\n```\n\n### Serialization\n\n```Go\npackage main\n\nimport \"github.com/OldPanda/bloomfilter\"\n\nfunc main() {\n\t// expected insertion=500, error rate=0.01\n\tbf, _ := bloomfilter.NewBloomFilter(500, 0.01)\n\t// add 0~199 into bloomfilter\n\tfor i := 0; i \u003c 200; i++ {\n\t\tbf.Put(i)\n\t}\n\n\t// serialize bloomfilter to byte array\n\tbytes := bf.ToBytes()\n\t// handling the bytes ...\n}\n```\n\n### Deserialization\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/OldPanda/bloomfilter\"\n)\n\nfunc main() {\n\t// create bloomfilter from byte array\n\tbf, _ := bloomfilter.FromBytes(bytes)\n\t// check whether number 100 is in bloomfilter\n\tfmt.Println(bf.MightContain(100))\n}\n```\n\n## Benchmark\n\nThe benchmark testing runs on element insertion and query separately.\n\n```Bash\n» go test -bench . -benchmem ./...\n# github.com/OldPanda/bloomfilter.test\ngoos: darwin\ngoarch: arm64\npkg: github.com/OldPanda/bloomfilter\nBenchmarkBloomfilterInsertion-12                11091939                90.62 ns/op           17 B/op          1 allocs/op\nBenchmarkBloomfilterQuery-12                    20389624                53.16 ns/op           15 B/op          1 allocs/op\nBenchmarkBloomfilterDeserialization-12            293098              3767 ns/op           13200 B/op         52 allocs/op\nPASS\nok      github.com/OldPanda/bloomfilter 3.719s\n```\n","funding_links":[],"categories":["Data Structures","数据结构与算法","Data Structures and Algorithms","Data Integration Frameworks","Uncategorized","Generators"],"sub_categories":["Advanced Console UIs","Standard CLI","布隆和布谷鸟过滤器","Bloom and Cuckoo Filters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOldPanda%2Fbloomfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOldPanda%2Fbloomfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOldPanda%2Fbloomfilter/lists"}