Writing Fast Programs: A Practical Guide for Scientists and Engineers

In this Chapter, the motivation for optimizing code will be presented. In addition, a brief comparison of an easy-to-learn, rapid development time language (Basic) and a fast language (C) will be given. Finally, a general outline for the process of optimization will be discussed. This background information is presented before the Chapters on "Hardware" (Ch. 2) and "Operating Systems" (Ch. 3) in order to provide the context in which these system components will be explored.
When thinking of computers as scientific problem solving tools, we typically envision two distinctly different images. The first is the large mainframe "supercomputer" housed in some environmentally controlled special room and maintained by a full-time staff of dedicated systems experts. These systems, in the scientific context, are typically accessed via remote site terminals and are used by many practicing scientists to run existing codes. That is, there is relatively little day-to-day code development by the scientist, and the codes are run "as-is" to produce some computational result. Very often, these codes are used to mathematically model a physical system, such as the programs used for Computational Fluid Dynamics (CFD), Quantum Chemistry ab initio calculations, Statistical Mechanics models of reasonably large systems and searches on extremely large datasets.
In contrast, the desktop computer (alternately referred to as microcomputer or PC) is typically imagined to play more of...