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

reworks update_completed_data_indexes when inserting shreds #4531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

behzadnouri
Copy link

Problem

blockstore::update_completed_data_indexes
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L4722-L4758

can be implemented more idiomatically and avoid several allocations in the process by just holding onto iterators:
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L4739
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L4757
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L2254

Additionally we can utilize Range<u32> instead of (u32, u32) tuples which are ambiguous if they are inclusive or not:
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L4731
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L4768
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L216-L222

Summary of Changes

The commit simplifies update_completed_data_indexes implementation, removes multiple intermediate allocations and uses Range<u32> instead of (u32, u32) tuples.

@behzadnouri behzadnouri force-pushed the bs-update-completed-data-indexes branch from 599804d to 285e3f4 Compare January 19, 2025 16:17
@behzadnouri behzadnouri force-pushed the bs-update-completed-data-indexes branch from 285e3f4 to 3bfd869 Compare January 20, 2025 01:15
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

Successfully merging this pull request may close these issues.

1 participant