Skip to content

Commit 6574fe7

Browse files
committed
Updating readme with implementation details section.
1 parent 455290f commit 6574fe7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cuckoo Filter
22

3-
[![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&utm_medium=badge&utm_campaign=pr-badge)
3+
[![GoDoc](https://godoc.org/github.com/panmari/cuckoofilter?status.svg)](https://godoc.org/github.com/panmari/cuckoofilter)
44

55
Cuckoo 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.
66

@@ -10,10 +10,23 @@ For details about the algorithm and citations please use this article for now
1010

1111
["Cuckoo Filter: Better Than Bloom" by Bin Fan, Dave Andersen and Michael Kaminsky](https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf)
1212

13-
## Note
14-
This implementation uses a a static bucket size of 4 fingerprints and a fingerprint size of 1 byte based on my understanding of an optimal bucket/fingerprint/size ratio from the aforementioned paper.
13+
## Implementation details
14+
15+
The paper cited above leaves several parameters to choose. In this implementation
16+
17+
1. Every element has 2 possible bucket indices
18+
2. Buckets have a static size of 4 fingerprints
19+
3. Fingerprints have a static size of 16 bits
20+
21+
1 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
22+
23+
f >= log2(2b/r) bits
24+
25+
With the 16 bit fingerprint size in this repository, you can expect `r ~= 0.0001`.
26+
[Other implementations](https://github.com/seiflotfy/cuckoofilter) use 8 bit, which correspond to a false positive rate of `r ~= 0.03`.
27+
28+
## Example usage
1529

16-
## Example usage:
1730
```go
1831
package main
1932

0 commit comments

Comments
 (0)