This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Speed impact of virtual inheritance
Frans Englich wrote:
> Followup question: what is the increased cost of calling a non-virtual,
> inlined function('inline' keyword) on a virtual base?
None, if the function is inlined -- and whether it is inlined or not
should not be affected by whether or not it is in a virtual base.
> What makes me ask these questions, is that I have code which(according to my
> opinion) severely needs virtual inheritance(VI). The code VI would affect is
> not under my veto power, and the maintainers of that code have so far given
> as comment "VI is out of the question. Period," without giving a deeper
> motivation, except "performance."
There are a number of C++ features (templates are another) which, for
various reasons, including inferior initial implementations, have gotten
a bad reputation. Often, with current G++, using such features has
near-zero cost. However, sometimes people who had bad experiences, or
just incorrect perceptions, are very hard to persuade. I don't have a
secret formula for arguing against such objections; usually, I just try
to directly attack the problem by modifying the code in question, or
using similar test programs, to show that there is little or no cost.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304