InfoQ Homepage News The Go 1.5 Compiler and Runtime are Written in Go

# The Go 1.5 Compiler and Runtime are Written in Go

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.

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.

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

• ##### Erratum

by Oumar FALL /

• ##### Re: Erratum

by Abel Avram /

• ##### Re: Erratum

by Oumar FALL /

• ##### Re: Erratum

by Abel Avram /

• ##### Erratum

by Oumar FALL /

Your message is awaiting moderation. Thank you for participating in the discussion.

"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 /

Your message is awaiting moderation. Thank you for participating in the discussion.

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

• ##### Re: Erratum

by Oumar FALL /

Your message is awaiting moderation. Thank you for participating in the discussion.

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.

• ##### Re: Erratum

by Abel Avram /

Your message is awaiting moderation. Thank you for participating in the discussion.

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

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

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.