Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters
dl.acm.org
dl.acm.org
The 8byte key is the only scenario where you should consider XorPlus (i.e a 8 bytes mapped to a long).
The lookup properties of the Xor filter are better with that case, but the real question is whether you have an entire collection to start building the bitset or not.
The sketch production isn't incremental - there is no add(k) after building it once.
So you can't build add data once it is built, while the Bloom filters do support adding entries after the fact (in fact, it can add bloom filters into it, rather than sending all the new keys).
And both of those approaches are missing an unset operation.
Yes insertion/deletion is required and the frequency may be higher. The exact usecase is that group membership is dependent on some conditions. We schedule this check every 15 minutes and based on it, we are adding/deleting the members.
Bloom filters allow adding members, but not removing them.
Cuckoo filters allow removing members: https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf
And just for completeness, storing everything losslessly in a btree, radix tree, or hash table would probably be under 300 kB. (80 kB just for the IDs plus, say, an additional ~2x overhead.)
Which means they can't be used for distributed set intersections, unions or cardinality estimations, a not insignificant side-benefit of bloom filters.
Bloom filters, cuckoo filters and XOR filters are all types of probabilistic lookup, which are different from normal hash tables.
This algorithm means you could easily have more than 10k especially for larger keys, and still likely reside in one of the cache levels. Heck a lot CPUs cant hold 10k items in L1. Like for 64 bit numbers thats 80Kb. Let alone for something like UUIDs or other larger sparse keys.
Also main memory access is aprox. delay of a few thousand cycles. Iterating a table of 10,000 items is going to be close to that. A hit in L1 is about 3 cycles. So a table scan is possibly slower or close to equal since a super scalar cpu has multiple execution ports.
Soon as you start getting any larger its easily gonna be slower to do a table scan.
This also gives you O(1) queries and being smaller means that table is more likely to reside in cache for any given look up. This smaller memory footprint is a great boon for any hash algorithm that involves look up.
It's pretty good fun though, so don't let pragmatism stop you. Just beware of premature optimization and all that.
All these algorithms are statistical, and should be checked by hand in the second phase, e.g. not-member is reliable but is-member should be confirmed.
Can someone succinctly explain the key idea for how this beats standard bloom/cuckoo filters?