Join GitHub today
cmd/compile: generate static calls when callee is known #18270
It would be nice if the compiler optimized dynamic function calls into static ones when the callee is known. This would save ~2ns/call for calls to functions with no free variables, and ~3ns/call for functions that need a closure.
changed the title from
cmd/compile: opt: generate static calls when callee is known
cmd/compile: generate static calls when callee is known
Dec 10, 2016
As of CL 65071 the compiler can inline f inside B
The more general problem of turning dynamic calls into static ones is still open though and will probably require some sort of copy propagation for function values. I'd like to take a stab at it at some point.