Boost logo

Boost :

From: Carl Daniel (cpdaniel_at_[hidden])
Date: 2002-02-13 11:21:20


From: "Daniel Frey" <daniel.frey_at_[hidden]>

>Yitzhak Sapir wrote:
>
>>
>> Try looking here:
>> http://www.research.att.com/~bs/bs_faq2.html#no-derivation
>
>But I happen to disagree with the first argument as a virtual function
>call may not be significally slower than a 'normal' function call, but
>it can yield a serious performance impact if it replaces an inline
>function call - inline functions, if they are small enough, can allow
>far more optimizations to the compiler and these are all lost for
>virtual functions. Therefore, I still consider Carl's point a valid one
>- although I have no solution for it :(

That's exactly why I cared - the compiler is was using generated horible code for virtual function call (about 30
instructions for 68EC030) versus a very simply (possibly inlined) direct call. In my case, it was in an embedded
application and I wasn't able to waste the space & time for all those extra instructions.

This is something I'd like to see as a lnaguage extension - It ought to be easy to implement in the compiler, and I'd
really not like to rely on the compiler's optimizer being smart enough to figure out on it's own that it can call the
correct function directly.

Anyway, kinda getting off topic for Boost - maybe a new thread on comp.std.c++....

-cd


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk