Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This chapter discusses how to design and write programs with performance in mind. Serial performance remains important even for parallel applications. There are two reasons for this. Each thread in a parallel application is a serial stream of instructions. Making these instructions execute as fast as possible will lead to better performance for the entire application. The second reason is that it is rare to find a parallel application that contains no serial code. As the number of threads increases, it is the performance of the serial sections of code that will ultimately determine how fast the application runs.
There are two approaches for improving the performance of an application. The first, which is unfortunately typical of many projects, is that performance is the problem to be solved once the program is functionally correct. The alternative approach is that performance is considered as one of the up-front specifications for the application. Taking performance into consideration in the initial phases of application design will lead to a better final product. This chapter discusses where performance can be gained (or lost) and how early consideration of performance can lead to an improved product.