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 weight updates in WeightedShuffle::search #4499

Conversation

behzadnouri
Copy link

@behzadnouri behzadnouri commented Jan 16, 2025

Problem

Below line is a left-over from old code and is not needed any more:
https://github.com/anza-xyz/agave/blob/1b9996194/gossip/src/weighted_shuffle.rs#L144

Summary of Changes

The commit removes unnecessary weight updates in WeightedShuffle::search.
Also removing some unnecessary trait constraints and adding bounds check to WeightedShuffle::remove_index.

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.

tbh always takes me a little bit to get back into the WeightedShuffle logic every time I look at it. But lgtm! Good catch on out of bounds check

@behzadnouri behzadnouri merged commit d3305e3 into anza-xyz:master Jan 16, 2025
47 checks passed
@behzadnouri behzadnouri deleted the weighted-shuffle-search-no-update-weight branch January 16, 2025 20:11
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