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 redundant vector allocations before calling sendmmsg::batch_send #4129

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

Conversation

behzadnouri
Copy link

@behzadnouri behzadnouri commented Dec 15, 2024

Problem

streamer::sendmmsg::batch_send only requires an ExactSizeIterator:
https://github.com/anza-xyz/agave/blob/82347779f/streamer/src/sendmmsg.rs#L169-L175

Collecting an iterator into a vector before calling batch_send is unnecessary and only adds overhead.
In particular multi_target_send used in retransmitting shreds can be use without doing an additional vector allocation:
https://github.com/anza-xyz/agave/blob/82347779f/streamer/src/sendmmsg.rs#L197

Summary of Changes

Removed redundant vector allocations before calling streamer::sendmmsg::batch_send.

@behzadnouri behzadnouri force-pushed the multi-target-send-rm-vec-collect branch 2 times, most recently from 365214b to 43d93a0 Compare December 15, 2024 19:33
@behzadnouri behzadnouri marked this pull request as draft December 15, 2024 20:46
@behzadnouri behzadnouri added noCI Suppress CI on this Pull Request and removed noCI Suppress CI on this Pull Request labels Dec 15, 2024
@behzadnouri behzadnouri force-pushed the multi-target-send-rm-vec-collect branch 2 times, most recently from 19acb5b to bbb62dc Compare December 16, 2024 21:31
@behzadnouri behzadnouri marked this pull request as ready for review December 16, 2024 22:46
@behzadnouri behzadnouri force-pushed the multi-target-send-rm-vec-collect branch 2 times, most recently from 63583bd to d73c5db Compare December 18, 2024 16:49
streamer::sendmmsg::batch_send only requires an ExactSizeIterator:
https://github.com/anza-xyz/agave/blob/82347779f/streamer/src/sendmmsg.rs#L169-L175

Collecting an iterator into a vector before calling batch_send is
unnecessary and only adds overhead.
In particular multi_target_send used in retransmitting shreds can be use
without doing an additional vector allocation:
https://github.com/anza-xyz/agave/blob/82347779f/streamer/src/sendmmsg.rs#L197
@behzadnouri behzadnouri force-pushed the multi-target-send-rm-vec-collect branch from d73c5db to 0142799 Compare December 18, 2024 18:03
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