Go 1.15 moves to beta, offering smaller binary sizes
Go 1.15, the next version of Google’s popular open source, statically typed, compiled language, produces smaller binary sizes through an enhanced compiler. The runtime and linker also have been improved in the forthcoming release.
Typical binary sizes in Go 1.15, which is due for a production release in August, are reduced by about five percent compared to Go 1.14. This reduction is achieved by eliminating certain types of garbage collection metadata and more-aggressively eliminating unused type metadata.
In another compiler improvement, the toolchain now mitigates Intel CPU erratum SKX102 on GOARCH=amd64 by aligning functions to 32-byte boundaries and padding jump instructions. Although this padding increases binary sizes, this increase is more than compensated for by the release’s binary size improvements. Additionally, Go 1.15 adds a
-spectre flag to the compiler and the assembler to enable Spectre CPU vulnerability mitigations, though the Go team advises that these should almost never be needed.
The compiler in Go 1.15 also now rejects
//go: compiler directives that have no meaning for the declarations they are applied to, reporting a “misplaced compiler directive” error. These misspelled directives were broken previously, but were silently ignored by the compiler.
- The compiler’s
-jsonoptimization logging now reports large copies as greater than or equal to 128 bytes, and provides explanations of escape analysis decisions.
- For the runtime, allocation of small objects now performs better at high counts and has lower worst-case latency. Further, non-blocking receives on closed channels now perform as well as non-blocking receives on open channels.
- Substantial improvements have been made to the Go linker, reducing linker resource usage. For a representative set of large Go programs, linking was 20 percent faster and used 30 percent less memory on average, for ELF-based operating systems on AMD64 architectures, with more-modest improvements for other architecture/OS improvements. Key to the better linker performance are a newly redesigned object file format and a revamping of internal phases to boost concurrency.
- With the Go command, the
GOPROXYenvironment now supports skipping proxies that return errors. Proxy URLs now can be separated with commas or pipe characters. Also, various flag parsing issues in
go vethave been fixed.
- The core library now includes a package,
time/tzdata, that permits embedding the time zone database into a program.
- The vet tool now warns about conversions of the form string
xhas an integer type other than
byte. The vet tool also now warns about type assertions from one interface type to another interface type when the type assertion will always fail.
Copyright © 2020 IDG Communications, Inc.