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

use a simpler random 2-sampler #716

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

conradludgate
Copy link
Contributor

@conradludgate conradludgate commented Jan 10, 2023

While this only saves 40ns (70ns down to 30ns - probably more if there are other threads causing allocator contention)
per sample, I still think it makes sense to not allocate here.

This was the only use of sample_inplace in this codebase. I also have an impl that scales to higher amounts, but it uses const generics which won't fit in the current MSRV

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

Thanks!

@LucioFranco LucioFranco merged commit b01bb12 into tower-rs:master Jan 10, 2023
@conradludgate conradludgate deleted the simpler-random-sample branch January 10, 2023 17:17
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