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

Comments

Projects
None yet
5 participants
@wolf0403
Copy link

commented Aug 26, 2017

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

This comment has been minimized.

Copy link
Member

commented Aug 27, 2017

@OneOfOne

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2017

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

@aclements

This comment has been minimized.

Copy link
Member

commented Aug 28, 2017

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?

@wolf0403

This comment has been minimized.

Copy link
Author

commented Aug 28, 2017

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

This comment has been minimized.

Copy link
Member

commented Aug 29, 2017

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.

@aclements aclements closed this Aug 29, 2017

@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.
You can’t perform that action at this time.