Created
January 25, 2018 20:53
-
-
Save escholtz/c8cf46eef431a8d7925c91ecda5f0c54 to your computer and use it in GitHub Desktop.
Bloom Filter Size Estimates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/willf/bloom" | |
) | |
func main() { | |
items := []uint{10, 100, 1000, 2500, 5000, 10e4, 10e5, 10e6} | |
falsePositiveRate := []float64{0.01, 0.001, 0.0001} | |
msg := "%d items, %.4f false positive rate: %d bits, %d hash functions\n" | |
for _, n := range items { | |
for _, r := range falsePositiveRate { | |
m, k := bloom.EstimateParameters(n, r) | |
fmt.Printf(msg, n, r, m, k) | |
} | |
} | |
} |
Author
escholtz
commented
Jan 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment