-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
cmd/compile: high memory usage during compilation #23242
Comments
UPD: I simplified the code so that the effect remained.
|
Have you tried earlier Go versions, such as 1.0, 1.3 or 1.7? It would be useful to see if the unusual increment in size was added recently or not. |
This seems to be fixed in 1.10, although the compilation seems to use a lot more memory. |
/cc @mdempsky |
Might be related to #19818, which is about extra binary size (and extra compiler work) when multiple equal statictmps are converted into interface. That issue has a CL from @josharian, but it has been inactive recently since he's on leave. I believe he'll be back for 1.11. In any case, worth investigating if the fix for that issue also fixes this one. |
Ver 1.7.6
func() - Crash als with interface{}, time of compilation ~ 11 sec without -N -l func() - size 0,9 MB, time of compilation ~ 11 sec
Ver 1.10 Beta
func() = ?? MB, I did not wait for the compilation to finish. I think that this does not work without -N -l
func() - size 1,3MB time of compilation ~ 8 sec
|
Checking to see if this is still a problem: My input, with gratuitous assignment to global to ensure no dead code elimination:
Changing the declaration to
It took less time, and took less space, but not that much.
User time is in ratio 2.032 to 0.946 (2.15x). Two-thirds of the difference in size is in the text. Experimentally, I upped the repetition to 150,000, and saw no scary non-linearity. I think this is fixed. |
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="darwin"
What did you do?
go build -a -v -gcflags "-N -l" -ldflags "-s -w"
Size of executable file 1,9Mb
if I change the func() *string to the interface{}
then size of executable file 32Mb
If we exclude the -gcflags '-N -l' params, then interface{} is 2MB func() *string is 32MB
Next Step
I increase size of function
or
But the size remained the same. I think that this is not inline problem.
My questions
https://stackoverflow.com/questions/47968970/inlining-and-output-binary-size
The text was updated successfully, but these errors were encountered: