{"id":13411460,"url":"https://github.com/seiflotfy/cuckoofilter","last_synced_at":"2025-05-14T05:10:46.668Z","repository":{"id":34305267,"uuid":"38217968","full_name":"seiflotfy/cuckoofilter","owner":"seiflotfy","description":"Cuckoo Filter: Practically Better Than Bloom","archived":false,"fork":false,"pushed_at":"2024-07-15T13:13:51.000Z","size":53,"stargazers_count":1163,"open_issues_count":15,"forks_count":110,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-09T02:15:25.636Z","etag":null,"topics":[],"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/seiflotfy.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-28T23:22:09.000Z","updated_at":"2025-03-27T11:39:28.000Z","dependencies_parsed_at":"2024-10-15T00:21:12.152Z","dependency_job_id":null,"html_url":"https://github.com/seiflotfy/cuckoofilter","commit_stats":{"total_commits":56,"total_committers":21,"mean_commits":"2.6666666666666665","dds":0.5535714285714286,"last_synced_commit":"e3b120b3f5fb2d9cec531540cac9a98790e7ceb6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiflotfy%2Fcuckoofilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiflotfy%2Fcuckoofilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiflotfy%2Fcuckoofilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seiflotfy%2Fcuckoofilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seiflotfy","download_url":"https://codeload.github.com/seiflotfy/cuckoofilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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":[],"created_at":"2024-07-30T20:01:13.850Z","updated_at":"2025-05-14T05:10:46.528Z","avatar_url":"https://github.com/seiflotfy.png","language":"Go","funding_links":[],"categories":["Data Structures and Algorithms","数据结构与算法","Data Structures","Uncategorized","數據結構","数据结构","数据结构`go语言实现的数据结构与算法`","Data Integration Frameworks","\u003cspan id=\"数据结构-data-structures\"\u003e数据结构 Data Structures\u003c/span\u003e","Generators"],"sub_categories":["Bloom and Cuckoo Filters","布隆和布谷鸟过滤器","Advanced Console UIs","Standard CLI","Membership-proof data structures","高級控制台界面","标准 CLI","高级控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"# Cuckoo Filter\n\n[![GoDoc](https://godoc.org/github.com/seiflotfy/cuckoofilter?status.svg)](https://godoc.org/github.com/seiflotfy/cuckoofilter) [![CodeHunt.io](https://img.shields.io/badge/vote-codehunt.io-02AFD1.svg)](http://codehunt.io/sub/cuckoo-filter/?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nCuckoo filter is a Bloom filter replacement for approximated set-membership queries. While Bloom filters are well-known space-efficient data structures to serve queries like \"if item x is in a set?\", they do not support deletion. Their variances to enable deletion (like counting Bloom filters) usually require much more space.\n\nCuckoo ﬁlters provide the ﬂexibility to add and remove items dynamically. A cuckoo filter is based on cuckoo hashing (and therefore named as cuckoo filter). It is essentially a cuckoo hash table storing each key's fingerprint. Cuckoo hash tables can be highly compact, thus a cuckoo filter could use less space than conventional Bloom ﬁlters, for applications that require low false positive rates (\u003c 3%).\n\nFor details about the algorithm and citations please use this article for now\n\n[\"Cuckoo Filter: Better Than Bloom\" by Bin Fan, Dave Andersen and Michael Kaminsky](https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf)\n\n## Implementation details\n\nThe paper cited above leaves several parameters to choose. In this implementation\n\n1. Every element has 2 possible bucket indices\n2. Buckets have a static size of 4 fingerprints\n3. Fingerprints have a static size of 8 bits\n\n1 and 2 are suggested to be the optimum by the authors. The choice of 3 comes down to the desired false positive rate. Given a target false positive rate of `r` and a bucket size `b`, they suggest choosing the fingerprint size `f` using\n\n    f \u003e= log2(2b/r) bits\n\nWith the 8 bit fingerprint size in this repository, you can expect `r ~= 0.03`.\n[Other implementations](https://github.com/panmari/cuckoofilter) use 16 bit, which correspond to a false positive rate of `r ~= 0.0001`.\n\n## Example usage:\n```go\npackage main\n\nimport \"fmt\"\nimport cuckoo \"github.com/seiflotfy/cuckoofilter\"\n\nfunc main() {\n  cf := cuckoo.NewFilter(1000)\n  cf.InsertUnique([]byte(\"geeky ogre\"))\n\n  // Lookup a string (and it a miss) if it exists in the cuckoofilter\n  cf.Lookup([]byte(\"hello\"))\n\n  count := cf.Count()\n  fmt.Println(count) // count == 1\n\n  // Delete a string (and it a miss)\n  cf.Delete([]byte(\"hello\"))\n\n  count = cf.Count()\n  fmt.Println(count) // count == 1\n\n  // Delete a string (a hit)\n  cf.Delete([]byte(\"geeky ogre\"))\n\n  count = cf.Count()\n  fmt.Println(count) // count == 0\n  \n  cf.Reset()    // reset\n}\n```\n\n## Documentation:\n[\"Cuckoo Filter on GoDoc\"](http://godoc.org/github.com/seiflotfy/cuckoofilter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseiflotfy%2Fcuckoofilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseiflotfy%2Fcuckoofilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseiflotfy%2Fcuckoofilter/lists"}