Changes

Jump to: navigation, search
/* Maximizing memory usage */
: - Minimise string/char manipulation as this often requires memory allocations. (e.g. joining strings with +, use of MID$, LEFT$, RIGHT$, SPACE$)
== Maximizing Minimizing memory usage ==
To maximize minimize memory usage in BASIC here are some things to consider. The size of the tokenized program:: - Minimize Difficult to measure without looking at the size of your program by minimizing data in memory.: - Use short variable name lengthnames. The names are stored in the tokenized BASIC program as-is.: - Minimize the number of variables . The names are stored in the tokenized BASIC program everywhere they are used.: - Use as few lines as possible. It's a small saving of about 5 bytes per line.: - Use Consider using numbers vs strings and potentially 8-bit/or 16-bit values in DATA statements if storing numbers. String data can also be a good way to store 8-bit dataMinimising memory usage when the program is running:
: - Minimize string operations. (e.g. A$=SPACE$(30)+CHR$(28) in memory this first allocates a string of length 30 containing spaces, then it allocates a new string of length 31 with spaces and char 28 at the end and assigns it to A$. In this line at least 30 bytes have been wasted. So consider if you need strings or perhaps if possible pre-define them).
2,630
edits