Efficiency!programmatic When writing a program, the actual efficiency depends in part on the algorithmic efficiency described previously, but also on practical considerations, such as the choice of data type for a variable, allocation of memory, and compile-time substitutions. Since these are so tightly coupled to the programming language, we will explore programmatic efficiency in the context of writing C programs.
Before turning to specifics, it is important to recognize that there is a balance to be struck between cleverness and readabilityEfficiency!programmatic!readability and—the ease with which a program can be read and understood. Cleverness can at times yield significant efficiency improvements, but there is a cost in terms of the readability—and therefore maintainability1Efficiency!programmatic!maintainability and—of the code. Sometimes a small gain in efficiency is not worth the attendant loss in readability.
Finally, here is a list of …
This is a preview. Read the full book in print or ebook — get it from MIT Press (ISBN 9780262548762).
Instructor with access? Instructor login.