All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Go Language Performance Improvements: Shifting Memory Allocations from Heap to Stack

By

spacey

3mo ago· 10 min readenInsight

Summary

The article discusses recent efforts by the Go programming language team to improve performance by shifting more memory allocations from the heap to the stack. Heap allocations are slower and create additional load on the garbage collector, even with recent improvements. The team has been working on compiler optimizations to enable more stack allocations, which are faster and reduce garbage collection overhead. The article explains the technical differences between stack and heap allocations and describes specific changes made in recent Go releases to optimize memory allocation patterns.

Key quotes

· 4 pulled
We're always looking for ways to make Go programs faster. In the last 2 releases, we have concentrated on mitigating a particular source of slowness, heap allocations.
Each time a Go program allocates memory from the heap, there's a fairly large chunk of code that needs to run to satisfy that allocation. In addition, heap allocations present additional load on the garbage collector.
Even with recent enhancements like Green Tea, the garbage collector still incurs substantial overhead.
So we've been working on ways to do more allocations on the stack instead of the heap. Stack allocations are...
Snippet from the RSS feed
A description of some of the recent changes to do allocations on the stack instead of the heap.

You might also wanna read