Introduction to Go 1.3

The latest Go release, version 1.3, arrives six months after 1.2, and contains no language changes. It focuses primarily on implementation work, providing precise garbage collection, a major refactoring of the compiler tool chain that results in faster builds, especially for large projects, significant performance improvements across the board, and support for Solaris and Google's Native Client architecture (NaCl). It also has an important refinement to the memory model regarding synchronization. As always, Go 1.3 keeps the promise of compatibility, and almost everything will continue to compile and run without change when moved to 1.3.

Changes to the supported operating systems and architectures

Support for Native Client

TODO

Support for Solaris

TODO

Removal of support for Windows 2000

Microsoft stopped supporting Windows 2000 in 2010. Since it has implementation difficulties regarding exception handling (signals in Unix terminology), as of Go 1.3 it is not supported by Go either.

Changes to the memory model

The Go 1.3 memory model adds a new rule concerning sending and receiving on buffered channels, to make explicit that a buffered channel can be used as a simple semaphore, using a send into the channel to acquire and a receive from the channel to release. This is not a language change, just a clarification about an expected property of communication.

Changes to the implementations and tools

Stack

Go 1.3 has changed the implementation of goroutine stacks away from the old, "segmented" model to a contiguous model. When a goroutine needs more stack than is available, its stack is transferred to a larger single block of memory. The overhead of this transfer operation amortizes well and eliminates the old "hot spot" problem when a calculation repeatedly steps across a segment boundary. Details including performance numbers are in this design document.

Stack size

Go 1.2 increased the minimum stack size to 8 kilobytes; with the new stack model, it has been put back to 4 kilobytes.

Changes to the garbage collector

precision (TODO what to say) liveness (TODO what to say)

As part of the general overhaul to the Go linker, the compilers and linkers have been refactored. The linker is still a C program, but now the instruction selection phase that was part of the linker has been moved to the compiler through the creation of a new library called liblink. By doing instruction selection only once, when the package is first compiled, this can speed up compilation of large projects significantly.

Updating: Although this is a major internal change, it should have no effect on programs.

Status of gccgo

GCC release 4.9 will contain the Go 1.2 (not 1.3) version of gccgo. The release schedules for the GCC and Go projects do not coincide, which means that 1.3 will be available in the development branch but that the next GCC release, 4.10, will likely have the Go 1.4 version of gccgo.

Changes to the go command

TODO cmd/go, go/build: support .m files (CL 60590044) cmd/go: add -exec to 'go run' and 'go test' (CL 68580043) cmd/go: cover -atomic for -race (CL 76370043)

Miscellany

The program misc/benchcmp that compares performance across benchmarking runs has been rewritten. Once a shell and awk script in the main repository, it is now a Go program in the go.tools repo. Documentation is here.

Performance

The performance of Go binaries for this release has improved in many cases due to changes in the runtime and garbage collection, plus some changes to libraries. Significant instances include:

Also, the runtime now includes in stack dumps how long a goroutine has been blocked, which can be useful information when debugging deadlocks or performance issues.

Changes to the standard library

New packages

No new packages appear in the core libraries in Go 1.3.

Major changes to the library

There is an important new type added to the standard library: sync.Pool. It provides an efficient mechanism for implementing certain types of caches whose memory can be reclaimed automatically by the system.

TODO: crypto/tls: ServerName or InsecureSkipVerify (CL 67010043) possible breaking change

Minor changes to the library

The following list summarizes a number of minor changes to the library, mostly additions. See the relevant package documentation for more information about each change.