3 ms·
Call indirection prevents inlining. It's not about comparing indirect calls versus direct calls, it's about comparing indirect calls against no function call a
by dietrichepp 14y ago
Call indirection prevents inlining. It's not about comparing indirect calls versus direct calls, it's about comparing indirect calls against no function call at all.
For example, imagine a function that multiplies two matrices. If the matrices are statically typed, the resulting function would only need to allocate the result. If the matrices aren't statically typed, you need to dispatch on the type of each element in each matrix. That will take much longer.
Yes, there are ways around this in languages with dynamic dispatch. However, my point is that LLVM won't do it for you.