2 ms·
> Nothing Go-specific about that anti-pattern, I'm afraid. An optimizing compiler (which Go 6g/8g isn't really, though that may change) will usually be able to
by pcwalton 11y ago
> Nothing Go-specific about that anti-pattern, I'm afraid.
An optimizing compiler (which Go 6g/8g isn't really, though that may change) will usually be able to fix this up. The way it typically works is SSA conversion and method inlining followed by global value numbering. But this is not by any means the only way an optimizing compiler can repair this: many optimizing backends (for example, LLVM) have the notion of "readnone" functions that can be GVN'd away as well in many circumstances.