Specifications

Programing Tips - 1
How to Maximize Execution Speed
1. Use the precompiled variable A% to Z%. In an average program these will run 50% faster. Use as many as
possible, especially in FOR/NEXT loops and software counters.
For other variables there is a lookup time. To minimize lookup time declare the variables at the beginning of
the program to force them to be at the beginning of the variable table. Put the variables which need to execute
fastest at the beginning.
10 A=0:B=0:C=0:A$=""
2. Use constants rather than variables whenever possible in all functions and statements. Except for the
precompiled variables above, a “lookup” time is required.
POKE &9000,4 fastest
POKE A%,B% fast
POKE A,B slowest
3. The speed of execution is independent of the length of the variable name.
4. Place several statements on the same line. This will yield a slight increase in speed at the expense of clarity.
5. Use INC and DEC whenever possible. They are much faster than the standard syntax to increment variables.
INC A% fastest
INC A fast
A=A+1 slowest
6. All string operations are slow. This is especially true when concatenating strings. When printing, avoid string
concatenation.
PRINT A$;B$ fast
PRINT A$+B$ slow
7. Certain mathematical operations have long execution times: multiply, divide, SIN, COS, ATN, SQR, LOG,
EXP and ˆ.
8. Replace a list of conditionals with the ON GOTO statement:
10 ON X GOTO 200,300,400,500 fast
10 IF X=1 GOTO 200 very slow
20 IF X=2 GOTO 300
30 IF X=3 GOTO 400
40 IF X+4 GOTO 500
9. Even though remarks are not executed, there is a slight amount of overhead to skip over the list number. You
can use PC SmartLINK to strip out the remarks in the final program. However, this may have a significant
impact on clarity. Do this only if all other methods fail.