sehmaschine/django-filebrowser — pull request #66 by tow (2012-01-02 19:13:11+00:00)
Title: Better caching in base.py

I'm playing around with using the S3Boto backend. When this is active, lots of operations in base.py suddenly become very expensive, and rendering a filebrowser view takes ages.

These patches fix some of the worst offenders by caching results:

* dimensions, which isn't called lots, but is very expensive when called, and a typical file listing was opening each file 3 or 4 times to get its height/width
* isdir, which is cheaper, but still expensive on S3, and is called quite frequently
* exists, which actually had a bug previously (self.storage does not exist).

Applying these patches improved timings by about 70%, but I'm finding the S3 backend still too slow to be usable for real work. To make it work properly would need much heavier use of caching and would probably involve breaking the current abstraction.