Discussion regarding systematic approach to go about optimization of logic.
by Tony Albrecht
From the article:
The three stages mentioned here, while seemingly obvious, are all too often overlooked when programmers seek to optimize. Just to reiterate:
1. Identification: profile the application and identify the worst performing parts.The solution above is not the fastest possible version, but it is a step in the right direction—the safest path to performance gains is via iterative improvements.
2. Comprehension: understand what the code is trying to achieve and why it is slow.
3. Iteration: change the code based on step 2 and then re-profile. Repeat until fast enough.