While Go 1.7 development cycle is approaching its next milestone, Go committer Dave Cheney has reported on the team's efforts to improve the language toolchain for the coming release.
Based on current development state, Go 1.7 will easily be the best Go release ever, Cheney says. Effort to improve its toolchain have been focusing on 2 areas:
- compile and link times;
- code generation.
When it comes to compile times, the Go compiler has suffered from slower performance since being ported from C to Go. This issue has seen a lot of discussions and recent work done towards Go 1.7 aimed to reduce the amount of memory used by the compiler and to improve linking time. This has led the overall compile time down by approximately 20–30% vs. Go 1.5.3, as the image below shows.
As it can be seen, Go 1.4.3 compiler performance is still significantly better than current 1.7. The importance of the current improvement should not be understated, though, given the fact that the new Go compiler includes a completely new code generation back end which is not yet necessarily mature when it comes to performance.
It should be also noted that the decision to bootstrap Go compiler was not related to performance, rather to the advantages that using Go instead of C would bring to its development, including ease of writing correct code and debugging, better tooling, support for parallelism, etc. In fact, Go compiler code has been automatically translated from its C code base, rather than rewritten from scratch.
Code generation, as mentioned above, is the other main focus area for Go 1.7. The new backend moved to using static single assignment form (SSA), as LLVM and other compilers do, to enable many optimizations to the generated code. Those include better dead code elimination, register allocation, stack frame allocation and more. As Cheney documented, Go 1.7 new SSA backend produces in this preliminary stage of development up to 20% faster code. Additionally, it generates smaller binaries in comparison with Go 1.6 and it is on a par with Go 1.4 in many cases.