News for hackers. Stuff that matters.
Re:The cost of dynamic vs. static dispatch in C++ (2013) by npalli on Saturday February 28, 2015 @03:41PM (#9124972)
Not a good summary.

1. If the static method is trivial enough, the compiler can inline it removing the need for a function call. In that case, a virtual function call for a single increment op is 6 times slower.

2. If you disable inlining for the static method, curiously it is 1.5 times slower than the virtual function call.

3. Newer compilers have devirtualize that the OP could not test but should be able to give much better than the 6x degradation.

There are no comments on this comment yet.