[Tutor] How expensive is a function call

Arthur Siegel Arthur Siegel" <ajs@ix.netcom.com
Thu, 23 May 2002 13:54:11 -0400


Hi all.

I am trying to focus on performance issues
in this round of refractoring of something
I have been working on.

In a frequently called section of the code I need
to check for bounds - are my coordinates so
large that it will screw up the scene display.
If so, scale.

As I have it currently structured all the bounds checking
is in a seperate function at the module top level, and it is
automatically called within the  "update" function of 
a class  - as part of the recurring update processing.

It would probably have been better to test for the 
bounds condition within the class update function
itself rathering than exiting to a function that tests the 
bounds (and immediately returns if within bounds).

My question then is how much am I losing by this?
Is the call to the outside function that could to avoided
in most cases expensive?

In the helping people to help themselves - I have been
intimidated from trying to tackle profiling of performance.
Is anyone aware of a basic tutorial on this topic?

Thanks.

Art