jdriscoll/django-photologue — pull request #110 by hedleyroos (2014-09-30 15:19:38+00:00)
Title: Rafactor accessors to be lazily applied

The `add_methods` signal handler scales very poorly, about O(n^2), because it gets applied to every ImageModel or ImageModel subclass when the object is instantiated. If you have 150 image sizes and 100 objects on a page that translates to nearly 15000 redundant expensive calls. During real world testing I found that moving the methods to be lazily loaded saved 400 000 calls per request (according to Python profiler) on a media heavy site.