Re:Go Escape Analysis Flaws
by seanmcdirmid on Thursday February 12, 2015 @07:32PM
(#9042227)
Stack allocation that depends on escape analysis is not very predictable at all, unless the programmer can force an error if escape analysis fails.
Explicit stack allocation via pass/return-by-value structs (as in C#) works well if predictability is a goal.
Especially considering this very article is about the ways that escape analysis can fall down in surprising circumstances.
Re:Go Escape Analysis Flaws
by seanmcdirmid on Friday February 13, 2015 @12:26AM
(#9043037)
This is a problem with any optimization that relies on analysis vs. language guarantees; if you can't codify some optimization in your semantics, it might as well not exist and can go away given any small change in your code. You have to track both correctness and performance regressions, with no real easy guidance on the latter.
That said, the Go developers are also working on making garbage collection more predictable. [1]
[1] http://golang.org/s/go14gc