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

removes unnecessary allocations in shreds ingestion path #4530

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

Conversation

behzadnouri
Copy link

@behzadnouri behzadnouri commented Jan 18, 2025

Problem

Ingesting shreds unnecessarily allocates a HashSet to remove invalid repair-meta:
https://github.com/anza-xyz/agave/blob/0f56076a2/core/src/window_service.rs#L250

and a separate vector for repair flags:
https://github.com/anza-xyz/agave/blob/0f56076a2/core/src/window_service.rs#L338-L341

Similarly Blockstore::insert_shreds (called in broadcast-stage to insert own shreds during leader slots), allocates a vector for repair flags:
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L1381

All can be avoided if blockstore insert_shreds... api are updated to take an argument of type

shreds: impl ExactSizeIterator<Item = (Shred, /*is_repaired:*/ bool)>,

Summary of Changes

Removed unnecessary allocations in shreds ingestion path.

@behzadnouri behzadnouri force-pushed the rm-shreds-ingest-allocs branch 2 times, most recently from d9e5512 to c1b1ef1 Compare January 18, 2025 16:14
@behzadnouri behzadnouri force-pushed the rm-shreds-ingest-allocs branch from c1b1ef1 to fad5cb1 Compare January 19, 2025 15:02
Ingesting shreds unnecessarily allocates a HashSet to remove invalid
repair-meta:
https://github.com/anza-xyz/agave/blob/0f56076a2/core/src/window_service.rs#L250

and a separate vector for repair flags:
https://github.com/anza-xyz/agave/blob/0f56076a2/core/src/window_service.rs#L338-L341

Similarly Blockstore::insert_shreds (called in broadcast-stage to insert
own shreds during leader slots), allocates a vector for repair flags:
https://github.com/anza-xyz/agave/blob/0f56076a2/ledger/src/blockstore.rs#L1381

All can be avoided if blockstore insert_shreds api are updated to take
an argument of type

    shreds: impl ExactSizeIterator<Item = (Shred, /*is_repaired:*/ bool)>,
@behzadnouri behzadnouri force-pushed the rm-shreds-ingest-allocs branch from fad5cb1 to 482b9db Compare January 19, 2025 22:19
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