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
As been shown in #12450 by crude patch to make io.Copy reuse its underlying 32k buffer(s) workloads intensively (ab)using net/http can see a significant reduce in GC pressure. Since changes to io.Copy has already been proposed and rejected, I'd like to discuss the prospect of replacing at least some of the io.Copy calls in net/http by io.CopyBuffer with reused byte slices.
The net/http uses io.Copy the most in standard library, and I believe updating it to use recently introduced io.CopyBuffer is worth doing.
benchmark old ns/op new ns/op delta
BenchmarkCloseNotified-4 309569 273466 -11.66%
benchmark old allocs new allocs delta
BenchmarkCloseNotified-4 50 48 -4.00%
benchmark old bytes new bytes delta
BenchmarkCloseNotified-4 36006 3089 -91.42%
As been shown in #12450 by crude patch to make io.Copy reuse its underlying 32k buffer(s) workloads intensively (ab)using net/http can see a significant reduce in GC pressure. Since changes to io.Copy has already been proposed and rejected, I'd like to discuss the prospect of replacing at least some of the io.Copy calls in net/http by io.CopyBuffer with reused byte slices.
The net/http uses io.Copy the most in standard library, and I believe updating it to use recently introduced io.CopyBuffer is worth doing.
At least some of those calls are not subject to usual io.ReaderFrom/io.WriterTo optimizations.
I'm ready to implement changes in the upcoming days and propose a CL.
The text was updated successfully, but these errors were encountered: