Go 1.26 is faster thanks to Green Tea GC.

Paul Krill
4 Min Read

A newly unveiled garbage collector is set to slash garbage collection overhead by 10% to 40% in production applications heavily reliant on automatic memory management.

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

The release of Go 1.26 marks a significant update for the Google-developed programming language. This version now defaults to the high-efficiency Green Tea garbage collector (GC) and includes enhancements to generic types, making it easier to construct sophisticated data structures.

Officially launched on February 10, Go 1.26 is available for download at go.dev.

Previously an experimental feature in Go 1.25, the Green Tea GC is now poised to deliver a 10% to 40% decrease in garbage collection overhead for production applications with intensive GC usage, as stated by the Go development team. This efficiency gain stems from enhanced performance in marking and scanning smaller objects, attributed to superior locality and CPU scalability. The team anticipates additional GC overhead reductions of approximately 10% on newer AMD64-based platforms. Users preferring to opt out can disable the Green Tea GC during compilation by setting GOEXPERIMENT=nogreenteagc. However, this bypass option is slated for removal in the upcoming Go 1.27 release.

Go 1.26 now permits generic types to self-reference within their own type parameter list, a modification designed to streamline the creation of intricate data structures and interfaces, the Go team elaborated. Furthermore, the new function, used for variable instantiation, now accepts an expression as its operand, enabling the specification of an initial variable value. The go fix command has evolved into a central tool for modernizing Go projects, offering a straightforward method to align codebases with contemporary idioms and core library APIs. Notably, the fundamental runtime overhead associated with cgo calls has also seen a reduction of approximately 30%.

Also included in Go 1.26:

  • The compiler now has increased capability to allocate the backing store for slices directly on the stack, leading to notable performance improvements.
  • WebAssembly applications will benefit from the runtime’s new ability to manage heap memory in smaller segments, which substantially decreases memory consumption for programs utilizing less than approximately 16 MiB of heap space.
  • For 64-bit platforms, the runtime now initializes the heap base address with randomization upon startup. This acts as a crucial security measure, complicating attackers’ efforts to anticipate memory locations and exploit potential vulnerabilities, particularly when interacting with cgo, as noted by the Go team.
  • An experimental profile type, goroutineleak, is now available to identify and report leaked goroutines. This can be found within the runtime/pprof package.
  • An experimental simd/archsimd package has been introduced, offering direct access to architecture-specific SIMD (Single Instruction, Multiple Data) operations.
  • Go 1.26 represents the final release compatible with macOS 12 Monterey. Future versions, starting with Go 1.27, will necessitate macOS 13 Ventura or a newer operating system.
GolangProgramming LanguagesSoftware Development
Share This Article
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *