Skip to content
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

runtime: heap size increases from go1.8b2 to go1.9 (for map objects?) #21641

Closed
wolf0403 opened this issue Aug 26, 2017 · 5 comments
Closed

runtime: heap size increases from go1.8b2 to go1.9 (for map objects?) #21641

wolf0403 opened this issue Aug 26, 2017 · 5 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@wolf0403
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8beta2 darwin/amd64
go version go1.9 darwin/amd64

Does this issue reproduce with the latest release?

go1.9 is the latest release.

What operating system and processor architecture are you using (go env)?

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ryan/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gg/sjs9r81j4pn_jfr5dsb2vdmm0000gn/T/go-build863027025=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

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.

Code and Makefile:
https://play.golang.org/p/BHI9Z83OH_

What did you expect to see?

go1.9 performs on-par or better than previous versions.

What did you see instead?

$ make run
time ./m-1.8
690.032 690.032
2.95 real 3.67 user 0.84 sys
time ./m-1.9
693.451 693.451
2.81 real 3.53 user 0.63 sys

If I replace string values using string pointer - https://play.golang.org/p/QPHBXOtTfJ

$ make run
/usr/local/Cellar/go/1.8beta2_1/bin/go build -o m-1.8 m.go
/usr/local/Cellar/go/1.9/bin/go build -o m-1.9 m.go
time ./m-1.8
477.742 477.742
2.69 real 3.79 user 0.74 sys
time ./m-1.9
480.171 480.171
2.74 real 3.52 user 0.42 sys

There is always (?) a ~3M increase in heap usage.

@odeke-em
Copy link
Member

/cc @aclements @RLH

@OneOfOne
Copy link
Contributor

Am I reading the numbers wrong? because it is slightly faster while only using 3 extra MBs.

@aclements
Copy link
Member

I'm not sure what the issue here is. Your first example runs faster by all metrics in Go 1.9 and your second example consumes less user and system time with Go 1.9, which suggests that the slightly higher real time is from system noise or frequency scaling. I'm not particularly concerned about a 0.5% increase in RSS (especially without statistically significant evidence that there actually is a change; though even then I wouldn't be particularly concerned).

Perhaps you could clarify what the concern is?

@aclements aclements added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 28, 2017
@wolf0403
Copy link
Author

The time spent by each program varies a lot (it's reported by "time ./binary" from bash - I just did some re-run and get 2.76vs2.88, 2.82vs2.71) so I don't think it is saying Go 1.9 is consistently slower or faster in a conclusive way.

But in all my runs there is an increase in heap size in 1.9. The difference is small but consistent.

I'm fine if you say this is expected / known / too small to have real negative impact, etc.

const size = 10000000 / 10
./m-1.8
58.415 58.415
./m-1.9
60.071 60.071

const size = 10000000 / 100
./m-1.8
4.031 4.031
./m-1.9
4.056 4.056

@aclements
Copy link
Member

Thanks for the update. I'm not concerned about small heap changes like this, though. Small fluctuations between releases are quite common for a huge number of reasons.

@golang golang locked and limited conversation to collaborators Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants