Re:The Performance Impact of C++'s `final` Keyword
by dblohm7 on Tuesday April 23, 2024 @01:25PM
(#40134545)
Firefox has done a lot of work on devirtualization over the years. There is a cost.
Re:The Performance Impact of C++'s `final` Keyword
by simonask on Wednesday April 24, 2024 @03:31AM
(#40141665)
Both the number of objects (dcache) and the number of classes (icache) are significant, as well as the size of both, but yeah. It's pretty rare to have extremely wide class hierarchies, though. You really have to go out of your way to run into significant icache misses.
My guess is this is why he didn't see any speedup: all the code could fit inside the L2 cache, so he did not have to pay for RAM access for the deference.
The number of different classes is important, not the number of objects as they have the same small number of vtable pointers.
It might be different for large codebases like Chrome and Firefox.