The Nuts and Bolts
So how do you optimize? Rather than learn a list of specific code optimizations, it’s far more important to understand the correct approach to optimizing. Don’t panic; we will see some programming techniques later, but they must be read in the context of this wider optimization process.
The six steps for speeding up a program are:
Determine that it’s too slow, and prove you do need to optimize.
Identify the slowest code. Target this point.
Test the performance of the optimization target.
Optimize the code.
Test that the optimized code still works (very important).
Test the speed increase, and decide what to do next.
This sounds like a lot of work, but without it you’ll actually waste time and effort and end up with crippled code that ...
Get Code Craft 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.