On 31 août 2014, at 21:36, Michael Buckley <[email protected]> wrote:

> I have seen benchmarks that show Django can process its templates faster if 
> you use django.template.loaders.cached.Loader.  Does django_synth work with 
> that, what effect does that have on the benchmarks?

If you look at the first email in this thread, you'll see that django_synth 
provides its own template loader.

In fact, three expensive things happen when you use a Django template:

1 - Finding it on the disk. Depending on your project structure, this may 
require many I/O calls.
2 - Parsing and "compiling" it. This allocates lots of small objects, which can 
be expensive.
3 - Evaluating it. This makes many function calls, which is expensive too.

Django's cached loader optimizes 1 and 2 through a simple in-memory cached. All 
it has to do is remember what templates are loaded and keep track of the tree 
resulting from the compilation step.

Since this strategy exists, 3 is the only thing that matters for real-world 
performance, where templates are loaded once and rendered many times.

Considering the approach taken by django-synth, it also takes care of 2 and 1, 
but that's an implementation detail.

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CD561565-FDD7-4D27-AC79-0EE3628A6E31%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to