Suppose you need to initialize X=2 and Y=3 in a program. One method is:
001 2
002 STO X
003 3
004 STO Y
A second method is to use EQN before each line
001 2 -> X
002 3 -> Y
where -> is the STO command.
The second method obviously reduces the number of lines of code, but is one method any more efficient (timewise) over the other? I haven't been able to discern a difference in my small programs, so it's just really a matter of curiousity.
CHUCK
Create a loop and time it:
E.g.:
A001 100
A002 STO I
A003 your code here
...
An DSE I
An+1 GTO A003
An+2 RTN
This will run your code 100 times. Use a stopwatch to time it.
Edited: 3 Oct 2007, 1:03 p.m.
Y001 LBL Y
Y002 0.999
Y003 STO X
Y004 2
Y005 STO Y
Y006 ISG X
Y007 GTO Y004
Y008 RTN
Used 1m 8s
Y001 LBL Y
Y002 0.999
Y003 STO X
Y004 eq 2>Y
Y005 ISG X
Y006 GTO Y004
Y007 RTN
Used 1m 57s
Edited: 3 Oct 2007, 1:22 p.m.
Okay, I looped it 100 times.
11 seconds with
2
sto x
3
sto y
and 20 seconds with
2 -> x
3 -> y
Looks like there is definitely a trade-off with speed -vs- size.
The difference in length is only
LBL A
2
STO
LN=67
LBL A
2>A
LN=66
Edited: 3 Oct 2007, 2:43 p.m.
Equation are parsed run time every time used, so clearly there will by an overhead.
I've not checked if this is the case here or not but don't trust the reported program lengths, they are wrong.
To measure sizes more accurately, try looking at the change in the bytes free in the memory menu.
- Pauli