Re:The Performance Impact of C++'s `final` Keyword
by connicpu on Tuesday April 23, 2024 @03:01AM
(#40129303)
But dynamically loaded libraries exist, so even if it knows the class is the most derived version out of all classes that exist in all of the statically-linked code through LTO or something, unless it can see the instantiation site it won't be able to devirtualize the function calls without the class being marked as final.
Now for libraries, this is a different story. There I can imagine final keyword could have an impact.