Observer Pattern and Performance questions
1) I am implementing a cpu-intensive class for image processing (motion detection) and when motion is detected an event is fired to a class MotionHandler that has a virtual function onMotion() that is called many times. How can i improve this virtual function situation? (i heard that calling virtual functions is expensive, is it true?) And can i inline that virtual function?
2) I always heard that i can improve my software performance by writing compiler-friendly code... but what the heck is that :P, how can i do it?
3) Will inlined functions always improve my performance? When it will or wont increase performance?
4) Pointers to classes (MyClass* ptr) are slower than "pure" classes (MyClass ptr)? If it is, how much is it slower than the other way?
5) Know what things cost - The principle of real time programming. But, how can i know it?
Thank you, i would really aprecciate some help =).