Whenever you make a call, the program has to write a little note to its self (the stack) about where that call occurred. When the call is done, it looks at this note so it knows where to continue processing.
The way your code was designed. There was a call Search() that you were using for each element of the array. When the program reaches that point; it makes a note of where it is, jumps to the Search call, when the Search call is done it looks at the stack to see where it was, and returns to that point. All these lookups can add to a speed hit. The optimization technique for dealing with this is called inlining. Take the code in the Search call and put it in the loop, you've inlined it, thusly avoiding stack traversal. Of course you have to balance the speed benefits against code complexity. It can become unwieldily to inline everything possible. Good commenting in your source code can help you to keep everything in order though. Hope that helps, ~ Tomis --- Patrick Cusack <[EMAIL PROTECTED]> wrote: > >It would be faster to search > >the array directly > >instead of doing all this abstraction. > > Your point about abstraction is well taken. What do you mean > regarding "traverse the stack for each element of the array?" > > > Patrick __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
