Skip to content

Commit 1f1e548

Browse files
authored
Update README.md
1 parent 8725f24 commit 1f1e548

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ is not important to have a good hash function, but collision should be unlikely
2626
(~1/2^64). A few collisions are acceptable, but we expect that your initial set
2727
should have no duplicated entry.
2828

29-
The current implementation has a false positive rate of about 0.3% and a memory usage
29+
The current implementation has a false positive rate of about 0.4% and a memory usage
3030
of less than 9 bits per entry for sizeable sets.
3131

3232
You construct the filter as follows starting from a slice of 64-bit integers:
@@ -65,6 +65,22 @@ type BinaryFuse8 struct {
6565

6666
When constructing the filter, you should ensure that there are not too many duplicate keys for best results.
6767

68+
# Generic (8-bit, 16-bit, 32-bit)
69+
70+
By default, we use 8-bit fingerprints which provide a 0.4% false positive rate. Some user might want to reduce
71+
this false positive rate at the expensive of more memory usage. For this purpose, we provide a generic type
72+
(`NewBinaryFuse[T]`).
73+
74+
```
75+
filter8, _ := xorfilter.NewBinaryFuse[uint8](keys) // 0.39% false positive rate, uses about 9 bits per key
76+
filter16, _ := xorfilter.NewBinaryFuse[uint16](keys) // 0.0015% false positive rate, uses about 18 bits per key
77+
filter32, _ := xorfilter.NewBinaryFuse[uint32](keys) // 2e-08% false positive rate, uses about 36 bits per key
78+
```
79+
The 32-bit fingerprints are provided but not recommended. Most users will want to use either the 8-bit or 16-bit fingerprints.
80+
81+
The Binary Fuse filters have memory usages of about 9 bits per key in the 8-bit case, 18 bits per key in the 16-bit case,
82+
for sufficiently large sets (hundreds of thousands of keys). There is more per-key memory usage when the set is smaller.
83+
6884

6985
# Implementations of xor filters in other programming languages
7086

0 commit comments

Comments
 (0)