MacArthur, Ian (SELEX GALILEO, UK) wrote:
> Also, can someone tell me... For a "fast" and "light" toolkit, is there
> a performance impact with the overloading and virtual functions?

Not with overloading, overloads are just different functions (which 
happen to share similar name) and the resulting machine code is the same 
as if you would use different names.

As Fabien writes elsewhere, virtual functions are somewhat slower due to 
additional dereferencing through vtable pointer and also normaly can not 
be inlined - exception might be situation when you explicitly use 
particular  incarnation of virtual function like

class Derived: public Base{
   void do_something(){
     Base::do_comething(); // could be inlined
     do_something_else();
   }
}

which could be inlined if the code for the base function is available 
and  appropriate compiler optimisation switches are set.

Nevertheless the penalty for virtualisation is small if the function is 
not really primitive one and you do not call it in some google loop, it 
hardly matters. And if you need a "virtual" functionality in some form, 
you do not have too many options - any codding around would be probably 
much worse.

R.

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to