▲ | 0xFEE1DEAD 4 days ago | |
In short: You're right - Go will still evaluate argument expressions. In hindsight, I should've made that more obvious, not calling this out initially was an expert blind spot on my part, not an intent to mislead. If we consider this example:
And look at the disassembly:
What disappears is the logging work (formatting, interface/slice plumbing, I/O) and the call itself.
Go cannot eliminate calls to functions inside of Printf because they could produce side-effects.
Eliminating functions calls like this would be very expensive to do and would clashes with Go's focus on fast compilation times.I'll add a section to the README that explains this. Thanks for pointing it out. |