r/cpp • • May 26 '22

Dynamic polymorphism performance

https://thecppdev.com/2022/05/26/dynamic-polymorphism-performance/?amp=1
2 Upvotes

15 comments sorted by

View all comments

3

u/DerShokus May 26 '22

Also would be interesting when compiler can optimize dynamic polymorphism. I mean (as I remember) compiler can use concrete type if it’s obvious what to use.

2

u/dodheim May 26 '22

Agreed, analyses of LTO and -fwhole-program-vtables would have been interesting.

1

u/goranlepuz May 26 '22

Indeed, in the TFA example the compiler really should be able to switch to a normal call.