Re:The cost of dynamic vs. static dispatch in C++
by tomp on Thursday December 05, 2013 @11:24AM
(#6855184)
Instead of devirtualization, a simpler optimization, which would additionally also help in the dynamic case, is simple loop hoisting of the method pointer fetch. Instead of doing
we could have
which would avoid two redirections per inner loop! Actually, I'm almost sure that is what LuaJIT would do, and many other high-level programming languages could perform this optimization as well. However, maybe C is too low-level to be able to do that, and I don't know about C++.
[ Parent
| on HN ]