You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/commands/bf.reserve/index.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,12 +46,13 @@ Though the filter can scale up by creating sub-filters, it is recommended to res
46
46
sub-filters requires additional memory (each sub-filter uses an extra bits and hash function) and consume further CPU time than an equivalent filter that had
47
47
the right capacity at creation time.
48
48
49
-
The number of hash functions is `-log(error)/ln(2)^2`.
50
-
The number of bits per item is `-log(error)/ln(2)` ≈ 1.44.
49
+
The optimal number of hash functions is `ceil(-ln(error_rate) / ln(2))`.
51
50
52
-
***1%** error rate requires 7 hash functions and 10.08 bits per item.
53
-
***0.1%** error rate requires 10 hash functions and 14.4 bits per item.
54
-
***0.01%** error rate requires 14 hash functions and 20.16 bits per item.
51
+
The required number of bits per item, given the desired `error_rate` and the optimal number of hash functions, is `-ln(error_rate) / ln(2)^2`. Hence, the required number of bits in the filter is `capacity * -ln(error_rate) / ln(2)^2`.
52
+
53
+
***1%** error rate requires 7 hash functions and 9.585 bits per item.
54
+
***0.1%** error rate requires 10 hash functions and 14.378 bits per item.
55
+
***0.01%** error rate requires 14 hash functions and 19.170 bits per item.
55
56
56
57
## Required arguments
57
58
@@ -86,7 +87,7 @@ Non-scaling filters requires slightly less memory than their scaling counterpart
86
87
When `capacity` is reached, an additional sub-filter is created.
87
88
The size of the new sub-filter is the size of the last sub-filter multiplied by `expansion`, specified as a positive integer.
88
89
89
-
If the number of elements to be stored in the filter is unknown, you use an `expansion` of `2` or more to reduce the number of sub-filters.
90
+
If the number of items to be stored in the filter is unknown, you use an `expansion` of `2` or more to reduce the number of sub-filters.
90
91
Otherwise, you use an `expansion` of `1` to reduce memory consumption. The default value is `2`.
0 commit comments