M
Marcel Müller
Hi,
I am seeking for a solution for the following performance issue:
class Interface
{public:
virtual int GetStatus() = 0;
};
class AbstractBase : public Interface
{private:
int Status;
public:
virtual int GetStatus() { return Status; } // Never overridden
};
If I call GetStatus() through a pointer to AbstractBase (or any derived
class) the call cannot be inlined because it is a virtual function. Of
course, there is no other way when using a pointer to Interface. But
there are many calls via pointers to AbstractBase or some of the derived
classes. I would like to avoid these function calls since almost any
method of derived classes do it and the implementation of GetStatus is
really trivial.
Is there any better solution than renaming the method of Interface to
GetStatusByInterface() or something like that?
Marcel
I am seeking for a solution for the following performance issue:
class Interface
{public:
virtual int GetStatus() = 0;
};
class AbstractBase : public Interface
{private:
int Status;
public:
virtual int GetStatus() { return Status; } // Never overridden
};
If I call GetStatus() through a pointer to AbstractBase (or any derived
class) the call cannot be inlined because it is a virtual function. Of
course, there is no other way when using a pointer to Interface. But
there are many calls via pointers to AbstractBase or some of the derived
classes. I would like to avoid these function calls since almost any
method of derived classes do it and the implementation of GetStatus is
really trivial.
Is there any better solution than renaming the method of Interface to
GetStatusByInterface() or something like that?
Marcel