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

reuses a thread-local weighted-shuffle for get_retransmit_addrs #4805

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

Conversation

behzadnouri
Copy link

@behzadnouri behzadnouri commented Feb 5, 2025

Problem

get_retransmit_addrs does a lot of allocations to clone WeightedShuffle:
https://github.com/anza-xyz/agave/blob/a3be62584/turbine/src/cluster_nodes.rs#L223

Summary of Changes

The commit uses a thread-local variable along with WeightedShuffle::clone_from to hold on to the allocation, reuse the same previously allocated memory, and minimize allocations.

@behzadnouri behzadnouri force-pushed the cluster-nodes-thread-local branch 3 times, most recently from fa452a2 to 009d694 Compare February 5, 2025 17:44
get_retransmit_addrs does a lot of allocations to clone WeightedShuffle:
https://github.com/anza-xyz/agave/blob/a3be62584/turbine/src/cluster_nodes.rs#L223

Using a thread-local variable along with WeightedShuffle::clone_from
allows to hold on to the allocation, reuse the same previously allocated
memory, and minimize allocations.
@behzadnouri behzadnouri force-pushed the cluster-nodes-thread-local branch from 009d694 to d6cf34f Compare February 6, 2025 01:54
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