4 ms·
Seems to be the smallest Go release yet (at least since 1.4). I wonder how the binary size was reduced in the recent two versions? 1.21 63MB 1.20 9
by febstar 3y ago
Seems to be the smallest Go release yet (at least since 1.4).
I wonder how the binary size was reduced in the recent two versions?
1.21 63MB
1.20 95MB
1.19 142MB
1.18 135MB
1.17 129MB
1.16 123MB
1.15 116MB
1.14 118MB
1.13 114MB
1.12 121MB
1.11 121MB
1.10 114MB
1.9 98MB
1.8 86MB
1.7 78MB
1.6 81MB
1.5 74MB
(linux-amd64 archives from https://go.dev/dl/ https://go.dev/dl/)
- FiloSottile 3y agoLong term intentional effort: https://go.dev/issue/27151 https://go.dev/issue/27151
- tough 3y agoAll I could find for context about what caused it (which is not reflected in that issue) > Go command The directory $GOROOT/pkg no longer stores pre-compiled package archives for the standard library: go install no longer writes them, the go build no longer checks for them, and the Go distribution no longer ships them. Instead, packages in the standard library are built as needed and cached in the build cache, just like packages outside GOROOT. This change reduces the size of the Go distribution and also avoids C toolchain skew for packages that use cgo. https://tip.golang.org/doc/go1.20 https://tip.golang.org/doc/go1.20
- Someone 3y agoPossibly compiler/linker improvements. For example, FTA: “In Go 1.21 the linker (with help from the compiler) is now capable of deleting dead (unreferenced) global map variables, if the number of entries in the variable initializer is sufficiently large, and if the initializer expressions are side-effect free.” There also may be differences in debug symbols in the various binaries.
- 38 3y agoOther two comments are wrong. The correct answer is that the compiler now builds everything on demand if it's not already built. This now includes the standard library as well. Previously built versions of standard library modules were being shipped.
- mighmi 3y agoIt seems like it rebuilds itself with PGO. I can't tell if I'm being paranoid/didn't only include stdlib in something, but I ran some random programs, restarted my computer and the install is now at 320mb, vs. 213 when I first untarred it. https://go.dev/doc/pgo https://go.dev/doc/pgo > PGO in Go applies to the entire program. All packages are rebuilt to consider potential profile-guided optimizations, including standard library packages.
- 38 3y agoPGO is opt in, just like Rust. you have to explicitly tell the compiler that you want to use it.
- yencabulator 3y agoGo1.21 uses PGO by default, if the file default.pgo exists. > The -pgo build flag now defaults to -pgo=auto, and the restriction of specifying a single main package on the command line is now removed. If a file named default.pgo is present in the main package's directory, the go command will use it to enable profile-guided optimization for building the corresponding program.