Performance by Design
This chapter has outlined a number of different places in the design process that impact performance. One way of visualizing this is to realize that there is a maximum possible performance for a given combination of system and problem to be solved. The choices made during design and implementation will either lead to the system meeting this maximum upper bound or cause the performance to be below this.
Decisions made early in the design process potentially have the largest impact on the performance of the application. The choice of algorithm can completely change the way the application behaves as the size of the problem increases. Similarly, a poor choice of algorithm can limit the scaling of the application as the number of available cores increases.
In many cases, it is possible to write the application in such a way as to encapsulate the choice of algorithm for critical parts of the code so that if it becomes critical to per-formance, it can be replaced at a later point. With careful consideration, the code can be structured so that the compiler can optimize away any inefficiencies introduced by this encapsulation.
With all design processes, it is usually easy to make significant changes early in the design process rather than later. Change introduced earlier takes less effort to implement and is cheaper than late-introduced fixes. Hence, early consideration given to appropriate workloads and use cases will lead to better choices during design and implementation.
All too often, performance tuning is considered at the point just before the applica-tion ships or at the point that it becomes obvious that the application is too slow. At this stage, it can be hard, and costly, to make the changes that are necessary to improve per-formance. Figure 2.18 shows the traditional view of the impact of change over the development cycle of an application.
Some program modifications are relatively easy to do at the end of the development cycle, such as changing the compiler flags, but the impact is likely to be small. Other actions, such as implementing a new algorithm, will have much higher costs if per-formed at the end of the project but could have a much greater impact. Ideally, such high-impact work should be completed early where it incurs less cost.
Copyright © 2018-2021 BrainKart.com; All Rights Reserved. (BS) Developed by Therithal info, Chennai.