BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

The Go 1.5 Compiler and Runtime are Written in Go

| by Abel Avram Follow 4 Followers on Aug 21, 2015. Estimated reading time: 2 minutes |

Go 1.5 has a complete tool chain written in Go, a quicker garbage collector and runs a goroutine on each available CPU.

Previous releases of the language had better performance by improving the compiler, garbage collection and tooling, plus support for more platforms such Android/ARM, BSD, Solaris, NaCl. Google mentioned with each release that they were still keeping the compatibility promise which basically said “Except for security issues, no incompatible changes to the specification would be made.”

Go 1.5 is no different from previous releases, although some users have complained having problems compiling or running their programs, as shown by the list of Go issues. While Google considers 1.5 as a “significant release”, most of the changes are underneath the hood, pushing the performance even further. Some of the improvements are:

  • The compiler/linker/assembler and the runtime have been converted from C to Go and a few lines of assembly, removing all the initial C code. The compiler was translated automatically with tools and with some final cleanup by hand to void introducing new bugs, according to Robert Pike, co-designer of Go. The runtime was rewritten by hand with the helps of some tools. The new compiler was 10x slower in the beginning because some of the C constructs were not converted into efficient Go code, but the performance was drastically enhanced in subsequent steps. Some of the benefits of getting rid of C are: one codebase for all platforms, new platforms can be added easier, a unified tool chain with less code and simplified maintenance. One drawback: builds take twice the time they needed because of the idiomatic Go code generated by tools for the compiler. Google intends to lower the build time in 1.6.
  • There is one compiler, one linker and one assembler targeting the desired architecture and OS with $GOARCH and $GOOS.
  • Go 1.4 or later is necessary to build the distribution from source code.
  • A new concurrent garbage collector (CGC) has been added to the standard stop-the-world one, lowering the GC activity to under 10ms for heavy activity for each 50ms time slot. More details on the new CGC can be found in this design document or these slides. Programs run a few percentages faster compared to 1.4.
  • Some 32-bit distributions are no longer available due to the general trend to transition to 64-bit architectures.
  • A new go tool trace command provides fine grained tracing

A possible breaking change introduced in Go 1.5 is the maximum number of threads that can run simultaneously, which has been raised from 1 to the number of CPUs available. If a program depends on the order on which goroutines are executed, it is highly possible the program to have unexpected results and needs to be fixed. More details can be found in this design document.

Other enhancements: support for internal packages for all repositories, vendor support, command-line go doc command, and others. For more details on what’s new in Go 1.5 we recommend the release notes.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Erratum by Oumar FALL

"Go 1.5 is necessary to build the distribution from source code."

Actually it's Go 1.4 who is necessary to build Go 1.4

Re: Erratum by Abel Avram

Go 1.5 is necessary because it needs the Go compiler. You no longer can use the C toolchain.

Re: Erratum by Oumar FALL

Thats why you need a fonctionning Go interpreter (<= 1.4) :)


Go 1.5 will use a toolchain written in Go (at least in part).
Question: how do you build Go if you need Go built already?
Answer: building Go 1.5 will require having Go 1.4 available.


docs.google.com/document/d/1OaatvGhEAq7VseQ9kka...

Re: Erratum by Abel Avram

I have edited the text to read: "Go 1.4 or later is necessary to build the distribution from source code." See golang.org/doc/go1.5#build
Thank you.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT