Performance optimization, and how to do it wrong