[sldev] Question on Overuse of virtual in C++

Dirk Moerenhout blakar at gmail.com
Sun Jul 1 15:32:15 PDT 2007


> On the design side however, unless you are dealing with
> extremely performance sensitive code, if in doubt, it's
> usually a good idea to make functions virtual and not need
> it than the other way round.

Well we're dealing with performance sensitive code as it's one of the
top functions (when using an optimised viewer) even though it has only
4 instructions (including RET ...). I get upto 2% of the cycle samples
in those 4 instructions and that doesn't take into account all the
wasted cycles on additional instructions that are needed to do the
call.

Dirk aka Blakar Ogre


More information about the SLDev mailing list