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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access