Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: recognize case <-time.After(x) #8895
Compiler can recognize the common: case <-time.After(x): construct and lower it into: runtime.selectrecvafter(x) Runtime can handle this case much more efficiently: no need to create Timer, chan and arm timers; it just needs to do a timed park of the goroutine until x. As a bonus, the timer does not leak.