mozilla/affiliates — pull request #209 by Osmose (2014-05-08 19:07:08+00:00)
Title: Performance tweaks

Did you know that the profile page hit the database for 40 separate queries? The dashboard hit it 36 times! Jeebus!

First, I went through and added a bunch of `prefetch_related` and `select_related` calls to reduce the number of calls to more reasonable levels. Once that was done, I slapped `django-cache-machine` on everything, which makes most pages hit 1-3 queries max after the first pageload. Yay!

I was considering adding some cache headers as well to cache entire responses, but I'm not sure if we should bother without some better data post-release on how the site is performing. Input on that particular point would be appreciated.