You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After waits for the duration to elapse and then sends the current time on the returned channel. It is equivalent to NewTimer(d).C. The underlying Timer is not recovered by the garbage collector until the timer fires. If efficiency is a concern, use NewTimer instead and call Timer.Stop if the timer is no longer needed.
We should replace time.After with time.Timer if we want to poll some code to avoid unnecessary allocation and deallocation.
Benchmark to compare time.After vs time.Sleep vs time.Timer vs time.Ticker
Issue summary
The docs for time.After says
We should replace
time.After
withtime.Timer
if we want to poll some code to avoid unnecessary allocation and deallocation.Benchmark to compare
time.After
vstime.Sleep
vstime.Timer
vstime.Ticker
https://play.golang.org/p/jfmFQQQv-0I
Other information and links
The text was updated successfully, but these errors were encountered: