All right, so you’ve learned the key performance optimization techniques and can apply them to your code. But what do you do when none of the techniques we’ve discussed work?
Profiling is the only sure way to answer the question “What is slowing this code down?” Profiling can be hard and time consuming, but there’s really no shortcut. If you can’t optimize just by looking at the code or by taking an educated guess, you have to profile.
Once you know exactly what is slowing you down, fixing it becomes trivial. So now I’ll teach you the arcane secrets of profiling, which will make finding out what’s slow easier.
Let’s start our exploration of profiling by breaking it down into its two basic parts. First, ...