Remote-processing CAMBASIC Bedienungsanleitung Seite 25

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 208
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 24
Program ing Tips - 2
can use PC SmartLINK to strip out the remar ks in the final program. H owever, this may have a significant
impact on clarity. Do this only if all other methods fail.
10. Spaces have no affect on speed since they are eliminated in the compiling process.
11. Data statements execute slowly. If you need large data tables, load them into RAM at the start of the
program, and access them with the PEEK function. While this is less convenient, it is faster.
12. The PRIN T USING statement takes longer to execute than PRINT, as it must format before sending the
characters.
13. FPOKE and FPEEK are the fastest memory accesses. T hey move four bytes at a time. If you have enough
memory to store multiple bytes, then use these constructs rather than PEEK, POKE, DPEEK and DPOKE.
FPOKE A%,B% is more than twice as fast as
POKE A,B in an average program
14. Array handling is, by its nature, slow in any language. Avoid multi-dimension arrays when possible.
15. When possible, use the DO/ENDDO loop instead of the FOR/NEXT. It is much faster.
16. The m ost effective w ay to speed up a progr am is through good progr amming. Highly m odular pr ogram s with
lots of subroutines and GOSUBs are easy to develop, read and maintain. However, they are slower than
optimizing program flow for speed.
17. When using a FOR/NEXT loop, avoid placing the variable after NEXT. This forces CAM BASIC to verify
the variable name and slow down execution of the loop.
10 NEXT fast
10 NEXT D slow
18. Do not use exponent to square or cube a number. It is a very slow operation.
10 A=X$2 very slow
10 A=X*X fast
10 A=X*X*X better than x$3
Other Tips
1. Sometimes a system will crash without any obvious cause. The crashing can occur because part of the
memory used by CAM BASIC has been modified by a POKE statement that is out of bounds. For example,
10 POKE A,B
The variable A is the address at which the POKE occurs. If the value of A inadvertently falls into the wrong
area, unpredictable results may occur. Some of these are:
a. Error message for a nonexistent line number.
Seitenansicht 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 207 208

Kommentare zu diesen Handbüchern

Keine Kommentare