2 ms·
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 functi
by npalli 12y ago
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.