News for hackers. Stuff that matters.
Re:The Performance Impact of C++'s `final` Keyword by teeuwen on Tuesday April 23, 2024 @02:50AM (#40129238)
I do not see how the final keyword would make a difference in performance at all in this case. The compiler should be able to build an inheritance tree and determine by itself which classes are to be treated as final.

Now for libraries, this is a different story. There I can imagine final keyword could have an impact.

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.
Re:The Performance Impact of C++'s `final` Keyword by pjmlp on Tuesday April 23, 2024 @03:11AM (#40129364)
Only if the complete source code is available to the compiler.