Hacker News new | ask | show | jobs
by FreakLegion 41 days ago
NB: You're trading non-negligible space efficiency here, which gets worse as you lower the false positive rate. Partitioning means uneven occupancy rates across partitions, and either you accept low occupancy (increased filter size overall) or you're pretty much guaranteed to have hot blocks (increased false positive rate for specific partitions).
2 comments

Given that they are partitioning into cache-line sized blocks, I assume they are partitioning as a time-space tradeoff?

[edit]

Rereading that section more carefully, they are concerned about concurrent write performance to the bloom filter; since two CPUs can not write to the same cache-line in parallel, it's definitely done for performance reasons.

It's absolutely a speed optimization, although more for reads than writes. The 64-byte cache line bit is a standard blocked Bloom filter. Add SIMD queries and that's about as fast as these things get.

The other side of the tradeoff is bumped ribbon retrieval. Blocked Bloom filters are about 50% bigger than BuRR.

You are describing "blocked" bloom filters here (i.e., the k hash functions are evaluated in a single block which is initially chosen by the hash). "Partitioned" bloom filters (i.e., each hash function is evaluated in a separate partition) don't have the imbalance problem you describe.
I'm describing the data structure from the article, which is partitioned twice: first into 64-byte, then into pairwise coprime-sized chunks. The 64-byte chunks are what you're quoting as "blocked", the pairwise coprime-sized chunks as "partitioned". The space inefficiency I mentioned applies to the 64-byte chunks.
You can mitigate this imbalance (at the expense of more cache misses) in the usual way by applying the power of 2 choices:

https://lph.ece.utexas.edu/users/krimer/pub/im11_bf.pdf

More cache misses, and also an increased false positive rate from doing multiple lookups. A similarly optimized cuckoo filter (cache line-sized buckets/windows and SIMD queries) is both smaller and faster.