Paul Krill
Editor at Large

Go 1.26 unleashes performance-boosting Green Tea GC

news
Feb 12, 20263 mins

New garbage collector promises a 10% to 40% reduction in garbage collection overhead in real-world programs that rely heavily on garbage collection.

shutterstock 40663132 green traffic light on black background
Credit: AlexandreNunes / Shutterstock

Go 1.26 has been released. The latest version of the Google-built programming language enables the higher performing Green Tea garbage collector (GC) by default. It also introduces a change to generic types that simplifies the implementation of complex data structures.

Introduced February 10, Go 1.26 can be downloaded from go.dev.

The Green Tea GC, included as an experimental feature in last year’s Go 1.25, brings a 10% to 40% reduction in garbage collection overhead in real-world programs that make heavy use of garbage collection, the Go team said. This is because it improves the performance of marking and scanning small objects through better locality and CPU scalability, according to the team. Further improvements are expected in GC overhead on the order of 10% when running on newer AMD64-based CPU platforms. For the cautious, the Green Tea GC can by disabled by setting GOEXPERIMENT=nogreenteagc at build time. This opt-out setting is expected to be removed in Go 1.27.

Generic types in Go 1.26 now may refer to themselves in their own type parameter list. This change simplifies implementation of complex data structures and interfaces, the Go team said. The newfunction, which creates a new variable, now allows its operand to be an expression, specifying the initial value of the variable. And the go fix command now is the home of Go’s modernizers, providing a push-button way to update Go codebases to the latest idioms and core library APIs. And the baseline runtime overhead of cgo calls has been reduced by about 30%.

Also in Go 1.26:

  • The compiler can allocate the backing store for slices on the stack in more situations, thus improving performance.
  • For WebAssembly applications, the runtime now manages chunks of heap memory in smaller increments, leading to significantly reduced memory usage for applications with heaps less than around 16 MiB in size.
  • On 64-bit platforms, the runtime now randomizes the heap base address at startup. This a security enhancement that makes it harder for attackers to predict memory addresses and exploit vulnerabilities when using cgo, the Go team said.
  • An experimental profile type named goroutineleak reports leaked goroutines. Look for it in the runtime/pprof package.
  • An experimental simd/archsimd package provides access to architecture-specific SIMD operations.
  • Go 1.26 is the last release to run on macOS 12 Monterey. Go 1.27 will require macOS 13 Ventura or later.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author