Re: TIB: A Disadvantage in TI-82 Basic, Modular Format


[Prev][Next][Index][Thread]

Re: TIB: A Disadvantage in TI-82 Basic, Modular Format



On Mon, 08 Dec 1997 21:22:44 EST minman@juno.com writes:
....
>:prgmB
>
>	Thus, this restarts the main program
>(prgmB) again *within* the main program (prgmB).
>It works correctly; however, I have noticed a
>slight, sometimes gradual decrease in speed
>whenever it does this.  What is doing this,
>and what can I do to correct this?  Keep in
>mind that I run prgmB off of prgmA (which is
>a small subprogram used to initiate everything
>and store values to variables).

Well, if you keep having recursive calls back to itself, without ever
returning, then it uses up more memory to keep track of everything(ie:
how far in it's nested in loops, where to return to, etc...).  When you
keep filling this up, it will gradually slow down since it's tracking
more and more stuff.  The way to solve this is to find a way to not
recurse into itself without a way to return.  Either don't recurse, or
find a way to return...  If neither are feasible, then you may need to
completely rework your programming logic to not cause infinite recursion.

>	I would really appreciate any helpful response.

I don't know if this will be helpful in your case or not, but a way that
I got around using goto statements is to use a While statement.  ex:

:While 1
:Menu(1,"1",A,2,"2",B,3,"3",C,4,"4",D,5,"5",E
:Lbl A
:pgrmA
:End
:Lbl B
:pgrmB
:End
:Lbl C
:pgrmC
:End
:Lbl D
:pgrmD
:End
:Lbl E
:pgrmE
:End

Each end acts as a goto the While statement.  Again I don't know if this
will suit your purposes, but I do know for a fact that it's smaller than
goto statements and I think it's faster since it doesn't have to look for
a label, it just remembers to "return" to the beginning of the While
statement.

I hope that something I have said will be of help to you.


Sincerely,
The Unibomer

Jared Ivey
Unibomer@Juno.com
http://www.geocities.com/SiliconValley/Vista/7342

"Nobody can be exactly like me. Even I have trouble doing it." --
Tallulah Bankhead


References: