On 3 juin 2011, at 16:44, Luke Plant wrote: > From what I've seen so far, your proposal sounds good.
I agree — consistency is good. > Is there a way > that we can keep the performance benefits of ConstantIncludeNode? For > example, if an IncludeNode detects that it resolves to the same template > path as last time, it doesn't load the template from disk again? If so, > that would remove my only objection. ConstantIncludeNode improves performance because it calls django.template.loader.get_template() only once in __init__() and not in each call to render(). get_template() invokes the template loading machinery to create a compiled Template object, given a template path. If it's a performance bottleneck, we can memoize its results. That will improve performance of all template lookup operations, not only {% include %}. We must ensure that during development, if we edit a template without touching the Python code, we get the new version and not the old compiled, memoized version. The easiest is to memoize only when TEMPLATE_DEBUG is False. There is already some code to cache loaded templates in django.template.loaders.cached.Loader, but as far as I can tell, it's only used during Django's own tests. This is also true for the reset() method of template loaders. If memoizing doesn't work — it's a bit crude — maybe we could extend this code to cache all template loading operations. Best regards, -- Aymeric Augustin. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.