>However, if the object escapes to the heap
Can this be detected statically?
Can this be detected statically?
It's easy enough to profile and benchmark in go, so I would always treat that as the source of truth.
Ergo, this value is safe to allocate on stack.