Chapter 13. When to Optimize
Faster, better, cheaper—choose two of the above.
When developing an application, it is important to consider performance optimizations and apply them where appropriate in the development cycle. Forgetting these optimizations (or getting them wrong) can be expensive to correct later in development.[1] In this chapter, we follow the various stages of the full product life cycle and consider when and why you might need to include some performance optimizations.
Performance tuning is frequently a matter of tradeoffs. Occasionally, you have the wonderful situation that a change to the application is better in every way: it provides better performance, cleaner code, and a more maintainable product. But more often, the performance of parts of an application are interrelated. Tuning one part of the application affects other parts, and not necessarily for the better. The more complicated the application, the more often this is true. You should always consider how a particular performance change will affect other parts of the application. This means that tuning can be a lengthy process simply because it must be iterative. The full performance-tuning sequence (identifying the bottleneck, tuning, and then benchmarking) is necessary to make sure that tuning one part of the application is not too detrimental to another part.
Performance tuning at the analysis and design phases differs from performance tuning at the implementation phase. Designing-in ...
Get Java Performance Tuning, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.