bloom filters

This is an educational implementation for bloom filters and is meant to be low LOC

  • The api is inspired a bit from the Guava impl
  • For hashes it uses xxhash - the specific implementations shared here

Other than that the overall implementation itself is very short owing to the fact that this works on byte chunks directly instead of understanding specific types ( and hence having handling for it which some libraries do )

Correctness I've verified via plots.

Plots

False positive rate vs k False positive rate vs n False positive rate vs m

To regenerate:

cmake --build build
./build/bloom_filter_stats_csv plots/data/cases.csv > plots/data/bloom_filter_stats.csv
gnuplot plots/gnuplot/fpp_vs_k.gp
gnuplot plots/gnuplot/fpp_vs_n.gp
gnuplot plots/gnuplot/fpp_vs_m.gp

Todo

  • perf benchmarks
  • modern variations added