File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,18 @@ class CBloomFilter
94
94
* insert()'ed ... but may also return true for items that were not inserted.
95
95
*
96
96
* It needs around 1.8 bytes per element per factor 0.1 of false positive rate.
97
- * (More accurately: 3/(log(256)*log(2)) * log(1/fpRate) * nElements bytes)
97
+ * For example, if we want 1000 elements, we'd need:
98
+ * - ~1800 bytes for a false positive rate of 0.1
99
+ * - ~3600 bytes for a false positive rate of 0.01
100
+ * - ~5400 bytes for a false positive rate of 0.001
101
+ *
102
+ * If we make these simplifying assumptions:
103
+ * - logFpRate / log(0.5) doesn't get rounded or clamped in the nHashFuncs calculation
104
+ * - nElements is even, so that nEntriesPerGeneration == nElements / 2
105
+ *
106
+ * Then we get a more accurate estimate for filter bytes:
107
+ *
108
+ * 3/(log(256)*log(2)) * log(1/fpRate) * nElements
98
109
*/
99
110
class CRollingBloomFilter
100
111
{
You can’t perform that action at this time.
0 commit comments