Cuprate / cuprate

Cuprate, an upcoming experimental, modern & secure monero node. Written in Rust
Other
130 stars 19 forks source link

Usage of filter data structures over sets #71

Open hinto-janai opened 9 months ago

hinto-janai commented 9 months ago

What

Filter data structures are smaller & faster than traditional sets.

Cuprate could use these over traditional sets (HashSet, BTreeSet) in cases where all we need to know is:

Off the top of my head, key image & peerlist checks could benefit from this.

These could also be used for a filter layer above the database to avoid disk access.

Filter usage in other projects:

These are essentially optimizations (which also come with negative side-effects, e.g. removal of a set member is more complicated in filters), so it isn't necessary right now, although we should eventually get around to it.

Filters

Some possible filters we could use. Starting from the most known with the longest history.

Filter Description
Bloom https://en.wikipedia.org/wiki/Bloom_filter
Cuckoo https://en.wikipedia.org/wiki/Cuckoo_filter
Xor https://arxiv.org/abs/1912.08258
Ribbon https://arxiv.org/abs/2103.02515
SyntheticBird45 commented 8 months ago

Saving this one for when the time comes: https://github.com/tomtomwombat/fastbloom/