FOR...NEXT or their FORTRAN of PASCAL equivalent DO loops work faster if
unnecessary arithmetic is reduced – so constants can be placed outside the loop.
It is also quicker to dispense with loops altogether in some cases where, for
example, an array has to be initialised.
FOR I=1 TO 3
if it is ‘unrolled’ to give the direct assignments:
since this avoids the work/time overhead associated with loops.
The worst offenders in almost all respects are programs originally written for
mainframe computers in which memory restraints are almost unknown and the clock
speed and cycle time are such that even inefficiently-written programs run
extremely quickly. Good programs, regardless of their function or the language
in which they are written, should take into account most, if not all of the
points raised in this article during their development The extra time and care
involved will certainly not be wasted!
Brown, A.R. and Sampson, W.A (1973) Program debugging: the prevention and cure
of program errors. Macdonald.
Monro, D.M. (1978) Basic BASIC. Edward Arnold,
LISTING FOR "MAKING CP/M USER FRIENDLY – By C. Bowden"