2 ms·
Defer already allocates on stack, in the case where it is only ever called once in a function, in HEAD I believe. Anyway, cherrypicking a single feature of Go
by jchw 7y ago
Defer already allocates on stack, in the case where it is only ever called once in a function, in HEAD I believe.
Anyway, cherrypicking a single feature of Go and claiming it's an example of why Go doesn't care about performance feels unfair. There's definitely been a huge amount of engineering effort spent on Go performance, especially latency in the GC. Defer is "slow" but it is probably rarely a bottleneck for anyone's use case. Try/catch are pretty slow in many languages.