Writing Fast Programs: A Practical Guide for Scientists and Engineers

The manner of memory allocation for data handling is crucial to high performance programming. Some high-level languages, such as C and Pascal, use a paradigm that requires memory be properly allocated before code accessing that memory is executed. This forces the programmer to plan memory allocation, but does not necessarily ensure efficiency.
Other languages, such as C#, BASIC and PERL, do not use the explicit allocation paradigm. This means that memory allocation can be done 'on the fly,' implicit in a memory access statement (such as a variable reference). Since the memory allocation is not specified by the programmer, the most efficient use of memory cannot occur.
Data typing has significant consequences for object code generation by the compiler. As a simple example, consider the statement a = a + 1, which can be compiled to an INC op-code only if a is an integer type. If, on the other hand, a references a memory location holding floating-point data, the INC op-code cannot be used. One thing to remember is that while in algebra variables are abstractions of quantities, in programming the situation is different. The variable name is an abstraction of a reference to memory. How that reference is abstracted obviously influences the compiled...