Hi, i'm author of the snippet http://www.djangosnippets.org/snippets/507/.
I have used simple dictionary because pickling and unpickling values
from the cache are IMHO to expensive and don't give a big speed boost
over parsing. Also if you use memcache or filesystem backend for
caching (pretty standard thing in production environment) you don't
really have a speed boost because you have to use IO to get template
(+pickle).

In my tests with pretty simple templates, lighttpd and fastcgi django
process, with my setup i've got from ~400 rps to almost 900 rps.
You could just create a blank app in your project and paste my snippet
in __init__.py file of that app, and put that app into your
INSTALLED_APPS tuple. Now you can enable and disable template caching
with just one line in your settings.


On Dec 23, 8:00 am, "Rob Hudson" <[EMAIL PROTECTED]> wrote:
> On 12/21/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> > In the early days of Django, Adrian, Simon et al looked at that. It
> > wasn't worth it, since, in the grand scheme of things, template caching
> > and checking the cache wasn't that much faster than loading and parsing,
> > particularly in the overall response time of a request (of which
> > template parsing is a relatively small component). Adding complexity for
> > minimal gain isn't usually a good idea. Unless this is a universal win,
> > it would be better to write it as a third-party template loader. It's
> > fairly easy to write a template loader that takes another template
> > loader as a parameter and just wraps caching around it and that keeps
> > the core code cleaner.
>
> I wonder if the template system has become a bit more complex since
> then.  I also wonder if whatever tests they used included things like
> includes in for loops.  I tend to think that the filesystem is slow
> and anything to remove FS calls and shove things in memory is a good
> thing -- especially something that could potentially be in a for loop.
>  Obviously there are trade-offs as you mention but the patch didn't
> look that complex to me -- actually it was surprisingly straight
> forward.
>
> I've considered applying this patch and testing against a project I'm
> working on.  Maybe that would help prove to either Django or me that
> this is or isn't worth it.
>
> Thanks,
> -Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to