Allocating on the Stack - The Go Programming Language

A description of some of the recent changes to do allocations on the stack instead of the heap.

Awesome stuff! Does Go have profile-guided optimization? I'm wondering whether a profile could hint to the compiler how large to make the pre-reserved stack space.

Yep. `go build -pgo=foo.pprof`

https://go.dev/doc/pgo

Profile-guided optimization - The Go Programming Language