Closed
Description
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.
go (master) $ find src/net/http -name \*.go -type f ! -name \*_test.go -exec cat '{}' \+ | grep -wc io.Copy
19
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.