Testing algorithms for efficiency
At this point, it is clear that we need our algorithms to be efficient. This section focuses on how we can measure algorithm efficiency based on our requirements. We will start with a short section on the importance of testing, then how to prepare for testing, how to conduct the tests, and what to do after testing.
Importance of testing
Simply put, if we do not test our algorithms for efficiency, we will not know for sure if they are efficient or inefficient. Optimizations are pointless if we do not measure their impact on a specific algorithm and overall application performance.
We might assume that we know what optimizations will result in the best performance based on our experience. Although this is experience-based, it is still merely anecdotal. Changes in input and the operating environment can challenge our previous knowledge of algorithm efficiency, so we should not assume without testing.
Tip: Become a testing zealot
Good programmers...