-
Notifications
You must be signed in to change notification settings - Fork 698
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
Pool timers to avoid allocations #297
Conversation
Test failure is unrelated and also happens on master (though only 2 times in 20 local runs, 10 with and 10 without -race). |
Since this works with sync.Pool testing is somewhat tricky. The test would need to disable GC (and reenable afterwards) and set GOMAXPROCS to 1 (and reset it afterwards) to prevent the pool from being emptied and to avoid rescheduling onto another P. If you want I can push a test. |
lgtm. Would be nice to have some basic tests around |
Pushed a new commit with a test that should work. |
Ah, okay. sync.Pool will randomly drop values when compiling with -race to prevent assuming it's behaviour. I changed the test to just check the behaviour of the timer instead. |
+1 |
Requests are somewhat allocation heavy. This should help a bit. Also has a small positive effect on requests performance (more for the old request style).
Benchstat (base 9147cfa):
Other benchmarks show no changes.