Re:Go-benchmark: Golang benchmarks used for optimizing code
by JulianMorrison on Wednesday June 20, 2018 @08:32AM
(#17354739)
Defer also runs in the case of a panic. So it's not just a hidden goto.
[ Parent
| on HN ]
Re:Go-benchmark: Golang benchmarks used for optimizing code
by 32bitkid on Wednesday June 20, 2018 @10:18AM
(#17355597)
more detail on why `defer` can/is more expensive (and not equivalent) to unrolling it: https://blog.golang.org/defer-panic-and-recover
Re:Go-benchmark: Golang benchmarks used for optimizing code
by arendtio on Wednesday June 20, 2018 @12:32PM
(#17356902)
Thanks, that is what I was looking for. I used defer just as convenience and wasn't aware (anymore) that it does something different than just pushing the function call to the end. Maybe it's time to take the Golang tour again ;-)