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

net/http: reusing http.Request is slower than allocating a new one #28310

Open
thesyncim opened this Issue Oct 22, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@thesyncim

thesyncim commented Oct 22, 2018

Please answer these questions before submitting your issue

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/okT3ECKTCiu

What did you expect to see?

the same or better performance in BenchmarkReuseRequest

What did you see instead?

lower performance and higher allocations
goos: darwin
goarch: amd64
BenchmarkDoNotReuseRequest-8 20000 79941 ns/op 4660 B/op 70 allocs/op
BenchmarkReuseRequest-8 5000 349885 ns/op 18562 B/op 157 allocs/op
PASS

System details

go version go1.11.1 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/stream/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/stream/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.11.1 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.1
uname -v: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G65
lldb --version: lldb-1000.0.37
  Swift-4.2

@thesyncim thesyncim changed the title from net/http reusing http.Request is slower than allocating a new one to net/http: reusing http.Request is slower than allocating a new one Oct 22, 2018

@agnivade

This comment has been minimized.

Member

agnivade commented Oct 22, 2018

/cc @bradfitz

@agnivade agnivade added this to the Unplanned milestone Oct 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment