Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: reuse the connection write buffer when hijacking
Previously, the connection write buffer used an extra 4kB of memory until the handler finished and the "conn" was garbage collected. ``` goos: linux goarch: amd64 pkg: net/http cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ ServerHijack-8 13.28µ ± 2% 10.84µ ± 3% -18.36% (p=0.000 n=10) │ old.txt │ new.txt │ │ B/op │ B/op vs base │ ServerHijack-8 15.84Ki ± 0% 11.77Ki ± 0% -25.70% (p=0.000 n=10) │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ ServerHijack-8 50.00 ± 0% 48.00 ± 0% -4.00% (p=0.000 n=10) ``` Signed-off-by: Jakob Ackermann <[email protected]>
- Loading branch information