Skip to content
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

Optimize BTreeSet intersections #2433

Open
sistemd opened this issue Dec 3, 2024 · 0 comments
Open

Optimize BTreeSet intersections #2433

sistemd opened this issue Dec 3, 2024 · 0 comments
Assignees

Comments

@sistemd
Copy link
Contributor

sistemd commented Dec 3, 2024

These intersections could be optimized if the blocks BTreeSet was represented with a bitset. Essentially, the blocks are always in the from_block..=to_block range, so each block can be represented as a bit, where the ith bit is on if the block from_block + i is present in the set. Then the intersection, cloned, and collect calls can be turned into a simple and operation on the bitsets.

This might not actually make a difference in practice, so we should measure carefully after doing this to decide if it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant