Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Go 1.15 Improves the Go Linker, Small Object Allocation, and More

Go 1.15 Improves the Go Linker, Small Object Allocation, and More

This item in japanese

The latest release of the Go language, Go 1.15, focuses on improving the toolchain, runtime, and core libraries. Besides improving the linker and allocation for small objects, Go 1.15 deprecates X.509 CommonName, supports a new embedded tzdata package, and more.

Go linker changes aim to reduce memory and CPU time usage as well as to improve code robustness and maintainability.

For a representative set of large Go programs, linking is 20% faster and requires 30% less memory on average, for ELF-based OSes (Linux, FreeBSD, NetBSD, OpenBSD, Dragonfly, and Solaris) running on amd64 architectures, with more modest improvements for other architecture/OS combinations.

The improvements were made possible by re-designing the object file format and increasing the linker internal concurrency. These changes are actually only the first outcomes of a multi-release effort to modernize the Go linker which will mostly benefit large-scale systems built in Go. As a matter of fact, the Go linker was originally written in C and semi-automatically converted to Go syntax, which makes it likely not the most optimized component in Go toolchain. In addition, its design remained unchanged in spite of the growth of the language and of the systems built with it.

There are features of Go that make it amenable to very efficient linking algorithms, none of which we take advantage of right now. Go also controls its object file format, giving us the opportunity to innovate and co-design the compiler, object format, and linker.

Go 1.15 compiler reduces generated binary size by eliminating some GC-related metadata. This brings a reduction by about 5% in comparison to Go 1.14. Furthermore, the compiler adopts stricter safety rules when converting unsafe pointers into uintptr which requires existing code using multiple chained conversions to be updated.

On the runtime front, Go 1.15 improves the way small objects are allocated at high core counts, also reducing lower worst-case latency. Additionally, converting small integers to interface values does not require memory allocation anymore.

Speaking of changes to Go core library, Go 1.15 changes the way of treating the CommonName field on X.509 certificates when no Subject Alternative Names are present. In such cases, the CommonName field is not treated anymore as a host name by default, although this behaviour may be re-enabled assigning the GODEBUG environment variable to the x509ignoreCN=0 value.

Additionally, Go 1.15 includes a new time/tzdata package to embed the timezone database into a program. This enables the program to find timezone information even if the timezone database is not available on the local system, albeit at the cost of an 800KB binary size increase.

Go 1.15 includes many more changes and improvements than what can be covered here, so do not miss the official release notes.

Rate this Article