For that coworker who won’t stop “optimizing” his or her code, I give you my rules of optimization:

  1. Don’t optimize
  2. Don’t optimize, I’m serious
  3. Don’t optimize without benchmarking first
  4. Don’t benchmark without profiling first
  5. See rule #1

Edit: A co-worker suggested a step 4.5 of “Take a coffee break”. I don’t like coffee, but I like the spirit of the suggestion.

2 thoughts on “Rules of Optimization

  1. Shouldn’t profiling be before benchmarking? If a chunk of code isn’t used a lot, speeding it up generally won’t make a bit of difference.

Comments are closed.