← Back to team overview

kicad-developers team mailing list archive

Re: Graphics Abstraction Layer (was Re: wxDC & wxGraphicsContext Test)


On Wednesday 24 February 2010, Wayne Stambaugh wrote:
> Each level of derivation adds an additional index dereference
> to the vtable of the class it is derived from. If you don't
> derive from a base class then no dereferencing overhead is
> incurred. With modern processors it probably makes little
> difference in speed and certainly nothing compared to the
> speed increase (hopefully) of using a hardware accelerated
> drawing API.

That is not what I recall ...

As I remember, each vtable is complete, so any call is:


regardless of the depth.

There is a link back for other reasons, but calling a virtual 
function does not trace back.

I admit I have not looked at it in many years, but when I did 
this is what it did. In the early days of C++ and STL I 
questioned the efficiency cost, so I investigated some of what I 
thought were potential issues. Every time, I found that the 
actual implementation was sensible and efficient. Stroustrup 
has stated in public that run time efficiency was considered 
important, and that no sacrifice compared to C was acceptable.


Follow ups