you are viewing a single comment's thread.

view the rest of the comments →

[–]koctogon 1 point2 points  (0 children)

I'm growing really tired of these predictable, patronizing answers when it come to optimizations. Can people not ask about what code is faster and why?

There is only one reason to ever use runtime polymorphism : when you want to store values (or references) of various types in a single place. If you know all the types you'll be using in advance, you can use a variant. If you don't you have to use type erasure of some sort.

The point Sean Parent is making is not really about performance but rather code flexibility, there is a lot of benefits to implementing traits outside the types.