4 ms·
If you can use templates, the decision of which function to call can be done at compile time and you don't need virtual calls. Virtual calls are useful when the
by kspiteri 12y ago
If you can use templates, the decision of which function to call can be done at compile time and you don't need virtual calls. Virtual calls are useful when the decision must be done at runtime.
- jjaredsimpson 12y agoArticle just seems like "I misused some feature X and it was slower than something else."
- tezka 12y agono it's not. it's more like, the most common dispatch pattern used in C++ (and most other OO languages) as a factor of 7x performance penalty over the less widely embraced alternative. The popularity of the former methods is partly due to the ignorance of programmers to its performance implications. I have seen huge code bases that had to be retired because of their over reliance on OO, and dynamic dispatch.
- kazinator 12y ago> I have seen huge code bases that had to be retired because of their over reliance on OO, and dynamic dispatch. What were they replaced with?