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 intermediate vector allocations in ClusterNodes::get_retransmit_addrs #4146

Merged

Conversation

behzadnouri
Copy link

Problem

ClusterNodes::get_retransmit_addrs does 2 intermediate .collect::<Vec<_>>:
https://github.com/anza-xyz/agave/blob/3890ce5bc/turbine/src/cluster_nodes.rs#L222
https://github.com/anza-xyz/agave/blob/3890ce5bc/turbine/src/cluster_nodes.rs#L239

Summary of Changes

The commit avoids both by chaining iterator operations.

@behzadnouri behzadnouri changed the title removes intermediate collect::<Vec<_>> in ClusterNodes::get_retransmit_addrs removes intermediate vector allocations in ClusterNodes::get_retransmit_addrs Dec 16, 2024
@behzadnouri behzadnouri force-pushed the get-retransmit-peers-rm-collect branch 3 times, most recently from b671371 to ecc3f0f Compare December 16, 2024 20:08
@behzadnouri behzadnouri force-pushed the get-retransmit-peers-rm-collect branch from ecc3f0f to e6f1b71 Compare December 16, 2024 21:33
Copy link

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few questions/comments

turbine/src/cluster_nodes.rs Show resolved Hide resolved
turbine/src/cluster_nodes.rs Show resolved Hide resolved
turbine/src/cluster_nodes.rs Show resolved Hide resolved
turbine/benches/cluster_nodes.rs Show resolved Hide resolved
Copy link

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@behzadnouri behzadnouri merged commit 11b2e32 into anza-xyz:master Dec 18, 2024
40 checks passed
@behzadnouri behzadnouri deleted the get-retransmit-peers-rm-collect branch December 18, 2024 02:27
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.

2 participants