On May 26, 2009, at 9:05 PM, David Levin wrote:
I think the principle is simple "classes that can avoid virtuals
should." There are lots of tricky situations, but in general make a
good effort to avoid virtual methods (which to me means be prepared
to answer why you need a virtual method in a given place).
By avoid them, there isn't a question of whether the virtuals are
affecting performance (in any way -- making inlining impossible,
adding to program size, messing with branch prediction, etc.)
Sometimes great perf is due to one cool algorithm, but a lot of
times it is also due to a thousand little things.
Indeed, and we try to do the thousands of little things when we can
find a practical pattern that enables us to do so. PassRefPtr is an
example of this; there is probably no one call site where avoiding
refcount thrash matters, but spread throughout the whole code base, it
adds up to a measurable improvement.
Regards,
Maciej
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev