[TIB] A TI-83 research question
[Prev][Next][Index][Thread]
[TIB] A TI-83 research question
Since I managed to stir up so much controversy with my
first TI-basic question, here's a hopefully less-challenging
question.
How do the following constructs affect the speed of a
Basic program on the TI-83 (yes, the "83-")?
(1) While loops as opposed to Repeat loops.
I've heard that Repeats are faster, I think,
but is this empirically true?
(2) Breaking out parts of a program into
subprograms.
In other words, which fragment is faster:
prgm:ABCDE or prgm:ABCDE
:If getKey:Then :If getKey:Then
:*do lots* :prgmFGHIJ
:*of stuff* :End
:*here*
:End prgm:FGHIJ
:*do lots of stuff here*
:Return
(3) Using Lbls with Gotos.
I've heard that Goto scans the program for
Lbls starting at the top and going down. Is
this empirically true? Does it matter where in
the program file the Goto occurs?
Are one- or two-character Lbls significantly
better with respect to speed?
I'm especially interested in point (2), since my philosophy
is to keep the number of program files to a minimum. Rogue
has two files, one of which contains a subroutine library
that looks something like this:
prgm:ZROGUE
If Ans="DESCMONSTER
Goto DM
If Ans="DESCOBJECT
Goto DO
If Ans="TRYMOVE
Goto TM
Lbl DM
name of monster -> Str1
Return
Lbl DO
...
Then when I need to print a message, I can call the subroutine:
prgm:ROGUE
...
"DESCMONSTER
prgmZROGUE
Disp "THE "+Str1+" HITS!
It would probably speed up the game to break out the subroutines
into prgmZDMONST, prgmZDOBJ, prgmZTRYMOVE, and so on, but would the
annoyance to the player (at having his calc Prgm menu be filled with
the programmer's subroutines) be worth the speed-up? That's why I
want to know about empirical tests of point 2 in particular.
Thanks,
-Arthur
Follow-Ups: