Optimization deliberately modifies software to improve a measured performance characteristic. Start by asking whether faster execution is necessary, which feature needs improvement, and what metric defines “fast enough.” section 1.3.3 section 12.3.2
Use a measurement-led process rather than optimizing by instinct:
- Define a specific performance target and establish baseline performance before changing the application. section 12.3.2
- Profile the application to locate where it spends time, then focus effort on the small portion that dominates execution. section 1.3.3 section 12.3.2
- Change the implementation iteratively, remeasure each change, and compare incremental gains with the added code complexity. section 1.3.3
- Stop when the application is fast enough; shipping useful features sooner can outweigh marginal speed improvements. section 12.3.2 section 12.9
A focused optimization pass
Suppose one application feature must become faster. Define how much faster it must be, measure its current performance, profile its execution, and improve the code responsible for most of the elapsed time. Repeat the measurement after each change and keep the change only if its benefit justifies its complexity. section 12.3.2 section 1.3.3





























