The following two (functionally equivalent) programs come from the old Compute Gazette issue. The main difference is that program 1 places the target base memory cells (7680 and 38400) in a line, while program 2 first assigns them to a variable.
Program 1 runs about 50% slower than program 2. Why? I would think that adding an extra variable will add time, not subtract it!
10 PRINT"[CLR]":A=0:TI$="000000"
20 POKE 7680+A,81:POKE 38400+A,6:IF A=505 THEN GOTO 40
30 A=A+1:GOTO 20
40 PRINT TI/60:END
Program 1
10 PRINT "[CLR]":A=0:B=7600:C=38400:TI$="000000"
20 POKE B+A,81:POKE C+A,6:IF A=505 THEN GOTO 40
30 A=A+1:GOTO 20
40 PRINT TI/60:END
Program 2
source
share