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

runtime: consider using batched shuffle in selectgo #68933

Open
josharian opened this issue Aug 18, 2024 · 3 comments
Open

runtime: consider using batched shuffle in selectgo #68933

josharian opened this issue Aug 18, 2024 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@josharian
Copy link
Contributor

josharian commented Aug 18, 2024

This is a minor optimization opportunity. runtime.selectgo typically does a shuffle of a fairly small number of channels. https://lemire.me/blog/2024/08/17/faster-random-integer-generation-with-batching/ introduces an optimization for such shuffles. It might be worth incorporating the technique into selectgo. (math/rand/v2 is probably not possible due to backwards compat.)

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 18, 2024
@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance labels Aug 19, 2024
@cherrymui cherrymui added this to the Backlog milestone Aug 19, 2024
@mknyszek
Copy link
Contributor

In triage, I don't think we have the bandwidth to look into this now, but patches welcome. :)

@lemire
Copy link

lemire commented Sep 9, 2024

@josharian Do you know how we might benchmark this?

@josharian
Copy link
Contributor Author

Something like BenchmarkSelectSync* in package runtime. Maybe add some benchmarks with more cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
Development

No branches or pull requests

5 participants