-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bloom): aggregate bloom filters #2340
base: main
Are you sure you want to change the base?
Conversation
8789370
to
39d5490
Compare
However, the problem with this is that we still store/load |
|
Good idea! |
@@ -13,18 +75,185 @@ use crate::ReorgCounter; | |||
// filter. | |||
pub const EVENT_KEY_FILTER_LIMIT: usize = 16; | |||
|
|||
/// An aggregate of all Bloom filters for a given range of blocks. | |||
/// Before being added to `AggregateBloom`, each [`BloomFilter`] is | |||
/// rotated by 90 degrees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I guess the correct mathematical wording would be transposition.
/// rotated by 90 degrees. | |
/// rotated by 90 degrees (transposed). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🙇
I'm curious to see how it boosts some really slow event queries in the rpc 👀 .
39d5490
to
32b48ae
Compare
This PR adds code for aggregate bloom filters. It doesn't do anything useful with the code, but under a conditional flag it will compare the results obtained from aggregate bloom filters with results obtained from regular bloom filters to ensure that the implementation is correct.
The bit matrix is implemented manually because somehow it's 10x faster this way than using the
bitvec
crate and also it's extremely simple. I have a hunch that we could get even more improvements if we usedu32
instead ofu8
to back the bit matrix. But this can be done later.The next PR will implement storing these aggregate filters in the DB, and then the final PR will implement actually using them from the RPC calls (and finally reaping the benefits).