■ Measure the performance of the entire system, make an educated guess about what to change, then re-measure. If the performance gets better, keep the change. If it doesn’t, discard it. Once your performance test passes, stop—you’re done
■ How to Optimize
• run your test suite one more time. Then integrate. If you’re adding new code, such as a cache, use test-driven development to create that code. If you’re removing or refactoring code, you may not need any new tests, but be sure to run your test suite after each change.
■ When to Optimize
– two major drawbacks : often leads to complex, buggy code, and it takes time away from delivering features
■ If your tests start to take too long, go ahead and optimize until you meet a concrete goal, such as five or ten minutes. Keep in mind that the most common cause of a slow build is too much emphasis on end-to-end tests, not slow code.