functions calling self

Blitz3D Forums/Blitz3D Beginners Area/functions calling self

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

justa quick note. When calling recursive functions you end up with whatever is loaded in memory each time the function is called before calling itself. So large object/type declarations etc. should be called after the recursive function call if possible. This will speed up your processing as well as shrink memory usage of the recursive function.

ie
BAD WAY
function FINDSTUFF(Value1)
dim HUGEARRAY(10022)
if x=y then
FINDSTUFF(x)
else
dootherstuff with HUGEARRAY
end if

end function

-----------------------
GOODWAY
----------------------
function FINDSTUFF(Value1)
if x=y then
FINDSTUFF(x)
else
dim HUGEARRAY(10022)

dootherstuff with HUGEARRAY
end if
end function



------------------
Its a simple thing to check after you get the function working. If you dont do it it may cost you heavy fPS for not streamlining.