Today I found an interesting article on ACM Queue, which explains a lot of theory behind performance tuning.
Performance, like any other feature, doesn’t just happen; it has to be designed and built. To do performance well, you have to think about it, study it, write extra code for it, test it, and support it.