BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Go 1.12 Improves Runtime Performance and Module Support

Go 1.12 Improves Runtime Performance and Module Support

This item in japanese

The latest release of Go, version 1.12, includes no syntactical changes to the language and focuses on improving runtime performance, the toolchain, and the module system. Additionally, it provides opt-in support for TLS 1.3, and improved support for macOS and iOS.

The most significant change to Go 1.12 concerns the way it handles memory allocation/deallocation at runtime. In particular, it brings performance improvements in the sweep stage of garbage collection, that scans the whole memory from start to finish to identify which blocks can be freed, when a large portion of the heap is to remain alive. This will reduce the time it takes to allocate new memory right after a garbage collection. Additionally, the garbage collector now releases memory back to the OS more aggressively, thus improving the overall memory footprint of a program. This behaviour is especially enforced after large allocations that could not reuse existing heap space.

Other improvements to the Go runtime include faster handling of network connection deadlines, thanks to improved timer and deadline code; support for disabling the use of optional CPU instruction set extensions, through the cpu.extension=off environment variable; and improved accuracy of memory profiles in programs that use large heap allocations.

Support for modules in Go 1.12 has been improved on a couple of counts. Preliminarly introduced in Go 1.11, the new module system coexists with the traditional GOPATH approach. To make the transition easier, Go 1.11 introduced a GO111MODULE environment variable to switch modules on and off and a default auto mode that attempts to use the module system whenever the go command is run in a directory tree outside GOPATH/src and whose root contains a go.mod file. Go 1.12 goes a step further and allows several go commands to run in module mode even if a go.mod file is not present. Additionally, Go 1.12 brings a number of fixes to the module system implementation.

As mentioned, the compiler toolchain has been improved as well, including more aggressive inlining of functions; a new -lang flag enabling the specification of which language version to use; better debugging information; and a potentially breaking change at the ABI level due to different calling conventions being used for Go and assembly functions.

As mentioned, Go 1.12 also introduces support for TLS 1.3, which can be enabled using tls13=1 in the GODEBUG environment variable. TLS 1.3 keeps support for all TLS 1.2 features, except TLSUnique in ConnectionState and renegotiation, with better or improved security and performance. Some TLS 1.3 features such as cipher suite configurability are not yet there, though. TLS 1.3 will become default in Go 1.13.

As a final note, the latest Go release also improves compatibility with macOS, iOS, AIX, and Windows on ARM.

There is much more to Go 1.12 that can be listed here, so make sure you do not miss the official release note.

Rate this Article

Adoption
Style

BT