#golang defer statements got faster in Go 1.13 and got much faster just now, for Go 1.14:
"cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata"
https://go-review.googlesource.com/c/go/+/190098
-
-
Replying to @bradfitz
Couldn’t defer be zero-cost at runtime (if not used dynamically) by having static metadata alongside each call instruction? Like the way unwinding works in C++.
2 replies 0 retweets 11 likes -
Here's the design doc: https://github.com/golang/proposal/blob/master/design/34481-opencoded-defers.md …
1 reply 0 retweets 1 like -
I see, you’re relying on const prop to get rid of the deferBits checks. The problem with that approach it that all the defers share the same bitfield, so const prop will miss optimizations (unless you have some of the fancy bit-sensitive stuff LLVM has).
1 reply 0 retweets 0 likes
I’d have tried using a separate variable for each defer, or else avoided using deferBits for some defer in the frontend where it’s easy to tell that the defer is always called unconditionally.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.