Why aren't my optimizations optimizing?

If you must optimize, make sure you're benchmarking valid test cases, with a reasonable set of test data, to ensure that you actually have an improvement. And before "improving" anything, take the optimization rules of M.A. Jackson to heart:


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2004/08/why-arent-my-optimizations-optimizing.html