Those of you still using BB4W v5.95a are missing out on a valuable feature available only in v6.00a: the REM!Fast compiler directive. This directive principally benefits large programs with thousands of variables, but there can be a worthwhile speed improvement even in a small program.
This is illustrated by the trivial benchmark program below. It compares the timing of a static integer variable (generally the fastest kind of variable) with that of a regular integer variable. Here are the results I get (Intel Core i7 running at about 3 GHz):
Environment | Static integer | Ordinary integer |
BB4W v6.00a IDE | 160 cs | 320 cs |
Compiled (no REM!Fast) | 160 cs | 290 cs |
Compiled with REM!Fast | 160 cs | 160 cs |
So the REM!Fast made the ordinary integer variable just as fast as the static variety, and about 80% faster than without the directive.
Richard.
Code: REM!Fast number%
TIME = 0 : FOR I% = 1 TO 5000000 : N% = N%+N%+N%+N%+N%+N%+N%+N%+N%+N% : NEXT : PRINT TIME
TIME = 0 : FOR I% = 1 TO 5000000 : number% = number%+number%+number%+number%+number%+number%+number%+number%+number%+number% : NEXT : PRINT TIME