vtable performance of important function in multiple inheritance
Hi,
I have an abstract interface:
struct StreamIntf {
~StreamIntf() {}
virtual int NextChar () = 0; // this must be FAST
};
Then I have another somewhat abstract interface:
class EObject {
};
and,
class EStreamIntf : public StreamIntf, public EObject {
// provide a real implementation that normally pulls the next
character from a buffer
// and only does an io read when the buffer is exhausted.
virtual int NextChar ();
};
and finally,
class EStream_io : public EStreamIntf {
// implement functions that actually read buffers
};
The question is: in the declaration of EStreamIntf, does the order of
subclasses listed matter in terms of the vtable performance of the
NextChar() function? Will this impact the performance of the virtual
members of the EObject functions provided by EStream_io and
EStreamIntf?
My guess is that if the performance of NextChar() outweighs all other
considerations, then StreamIntf should be listed first in the list of
subclasses of EStreamIntf. My second guess is that it does not matter,
that the performance will be the same as in virtual function calls of
single inheritance.
Andy
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]