-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What version of Go are you using (go version)?
1.17 vs 1.18
What operating system and processor architecture are you using (go env)?
linux/arm
Details
Regarding output binary size, the go 1.18 release notes only talk about changes (relative to 1.17) that potentially reduce size of output objects, due to linker optimisations etc. But under what circumstances would we expect 1.18 to produce significantly larger binaries than 1.17 for the same code?
Example: we have a medium-sized project that runs on an embedded linux/arm system. In this environment both performance (we do a lot of crypto stuff) and size are important. Output binary sizes for 1.17 vs 1.18 are as follows:
ldflags | 1.17 | 1.18
--------+-----------+-----------
none | 9548064 | 10586552
-w -s | 6684672 | 7340032
Both with no build flags and with -w -s we see a binary size increase of around 10% between 1.17 and 1.18, which is quite significant. (Binaries produced by 1.17 and 1.18 are similarly performant for us, so these extra bytes are 'for nothing'.)
I am not sure whether this is strictly a 'compiler bug' or if there are circumstances where 1.18 simply produces more bloated code than 1.17. If that is true, it would be extremely useful to know what those circumstances are, so we can work around them, not migrate to 1.18 for our build process, etc.
Any light and wisdom on this would be much appreciated!
-Adrian
Metadata
Metadata
Assignees
Labels
Type
Projects
Status