top | item 9124095

(no title)

kspiteri | 11 years 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.

discuss

order

jjaredsimpson|11 years ago

Article just seems like "I misused some feature X and it was slower than something else."

tezka|11 years ago

no 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.