I am wondering if there is a way to optimize case like following:
struct A{
virtual process(int x) const = 0;
virtual ~A() = default;
};
void useA(A const &a){
for(int i = 0; i < 1000; ++i)
a.process(i);
}
In case like this, if we promise somehow we wont change a
vtable, the virtual lookup can be done only once, outside of the loop.
Is there a way to do something like this or result will be very negligible? Or probably there should be some other problem I do not see yet?