Go 1.8, the next version of Google’s open source language, is moving toward general availability, with a release candidate featuring improvements in compilation and HTTP. The final Version 1.8 is due in February.
According to draft notes, the release candidate features updates to the compiler back end for more efficient code. The back end, initially developed for Go 1.7 for 64-bit x86 systems, is based on static single assignment (SSA) form to generate more efficient code and to serve as a platform for optimizations like bounds check elimination. It now works on all architectures.
“The new back end reduces the CPU time required by our benchmark programs by 20 to 30 percent on 32-bit ARM systems,” the release notes say. “For 64-bit x86 systems, which already used the SSA back end in Go 1.7, the gains are a more modest 0 to 10 percent. Other architectures will likely see improvements closer to the 32-bit ARM numbers.”
Version 1.8 also introduces a new compiler front end as a foundation for future performance enhancements, and it features shorter garbage collection pauses by eliminating “stop the world” stack rescanning.
The release notes also cite HTTP2 Push support, in which the net/http package can send HTTP/2 server pushes from a handler, which responds to an HTTP request. Additionally, HTTP server shutdown can be enabled in a “graceful” fashion via a Server.Shutdown method and abruptly using a Server.Close method.
Version 1.8 adds support for the Mips 32-bit architecture on Linux and offers more context support for packages like Server.Shutdown, database/sql, and .net.resolver. Go’s sort package adds a convenience function, Slice, to sort a slice given a less function. “In many cases this means that writing a new sorter type is not necessary.” Runtime and tools in Go 1.8 support profiling of contended mutexes, which provide a mutual exclusion lock.
Most of the upgrade’s changes are in the implementation of the toolchain, runtime, and libraries. “There are two minor changes to the language specification,” the release notes state. “As always, the release maintains the Go 1 promise of compatibility. We expect almost all Go programs to continue to compile and run as before.” Language changes include conversion of a value from one type to another, with Go tags now ignored. Also, the language specification now only requires that implementations support up to 16-bit exponents in floating-point constants.