golang/go

runtime: consider using batched shuffle in selectgo

Open

#68,933 opened on Aug 18, 2024

View on GitHub
 (8 comments) (0 reactions) (1 assignee)Go (19,008 forks)batch import
NeedsInvestigationPerformancecompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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.)

Contributor guide