3 ms·
Some C++ compilers support "fast path" devirtualization via profiling feedback: http://hubicka.blogspot.com/2014/04/devirtualization-in-c-part-5-feedback.html
by twoodfin 10y ago
Some C++ compilers support "fast path" devirtualization via profiling feedback:
http://hubicka.blogspot.com/2014/04/devirtualization-in-c-part-5-feedback.html http://hubicka.blogspot.com/2014/04/devirtualization-in-c-pa...
As you suggest, it's a little misleading to talk about the runtime cost of a virtual or indirect function call in isolation. The most significant cost is often the resulting inability of the compiler to inline and perform further optimizations across the caller and callee.
- eloff 10y agoNice, I had a feeling they did that, thanks for the link. I fully agree, missed optimization opportunity from not being able to inline is usually a bigger effect, because loops dominate the runtime and that's where those optimizations count.