days
-1
-6
hours
-1
-6
minutes
-2
0
seconds
-5
-6
search
Go faster than ever with these runtime improvements

Go 1.12 is a go for runtime improvements, module support, and more!

Jane Elizabeth
#go
Go 1.12
© Shutterstock / SERGEI BRIK

Spring is in the air and it’s time to check on our favorite Gopher! Go 1.12 is here; what does this update bring? Significant runtime improvements, more module support, some depreciated tools, and as always, backwards compatibility.

Go 1.12 is here!

Go has been quite good about their regular update schedule. There’s a new release every six months, like clockwork. Go 1.12 promises a number of runtime performance improvements, minor tool depreciations, improved module support, and absolutely no language specification changes. As always, this release complies with Go’s fundamental promise of backwards compatibility.

Let’s dive right in and see what’s in store for developers!

Go 1.12

Runtime improvements

Let’s start with the good stuff: Go 1.12 significantly improves runtime performance. This release reduces allocation latency immediately after garbage collection by sweeping when a large fraction of the heap remains live. For larger allocations that can’t reuse existing heap space, Go 1.12 releases memory back to the OS more aggressively.

The runtime timer and deadline code has been modified to scale nicely with more CPUs to improve network connection deadlines.

Memory-wise, the Go 1.12 release fixed the over counting of large heap allocations, improving the accuracy of memory profiles. For Linux, Go uses MADV_FREE to release unused memory for efficiency’s sake. However, although this does occasionally result in a higher reported RSS, the kernel reclaims unused data when necessary.

SEE ALSO: Going serverless with Google Cloud Functions and Go 1.11

Tools

Please note: Go 1.12 is the last release that will support binary-only packages. There are a few changes here, including a couple tools that have been depreciated.

Let’s go through the list!

  • go tool vet is no longer supported, since the go vet command has been rewritten to serve as the base for a range of different source code analysis tools. More information is available here.
  • The Go tour is no longer included in the main binary distribution.
  • Build cache is now required, since Go plans to gradually eliminate the $GOPATH/pkg.
  • godoc no longer has a command-line interface and is only a web server. Users should use go doc for command-line help output instead.

It’s been six months since the Go modules finally landed. There are a few changes here as well. When the GO111MODULE is activated, the go command supports module-aware operations outside of a module directory. Commands such as go get, go list, and go mod download behave as if in a module. Also, go commands that download and extract modules are safe to invoke concurrently.

As for the compiler toolchain, the compiler’s live variable analysis has improved. As a result, finalizers can be executed sooner than in older releases. More functions are eligible for inlining by default. Be careful and use runtime.CallersFrames instead of iterating over the result of runtime.Callers directly.

Additionally, the compiler now accepts a -lang flag to set the Go language version to use. This release also uses different conventions to call Go functions and assembly functions, although this should be invisible to users.

SEE ALSO: Go 1.11: What the new modules in Go are all about

Core library changes

Minor changes and updates here, mostly with backwards compatibility in mind. Check out the full list for all the details of what’s in and what’s out.

The Go 1.12 release adds opt-in support for TLS 1.3. All the TLS 1.2 features are available in TLS 1.3, except now there is better security and performance metrics. Take a look at all the changes here!

Getting Go 1.12

Want to upgrade? We don’t blame you; Golang is a very useful language to know and use.

The latest version of Go is available here. See the release notes for more information about the changes in Go 1.12.

Author
Jane Elizabeth
Jane Elizabeth is an assistant editor for JAXenter.com.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of