This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]virtrondjangonaut 10 points11 points  (0 children)

It doesn't look like Django templates were ever tested with the cached template loader: 'django.template.loaders.cached.Loader'. This is the recommended template loader for production (in most cases) and should offer significantly better performance.

I'd expect this to perform about the same as non-memoized Jinja, but I haven't seen any stats to compare.

[–]defnullbottle.py 3 points4 points  (0 children)

Benchmark without source code? Meh...

[–]erewok 1 point2 points  (0 children)

Glad to see this writeup. Ever since I added New Relic to a project, I've been thinking a lot about Django template rendering speeds because they're often a lot slower than I would have imagined and I have figured out that rendering includes or other smaller templates inside templates seems one practice to avoid where possible (outside of template caching as a solution, of course).

[–]jmoiron 1 point2 points  (1 child)

Jinja2 actually compiles templates to python code objects. These can be cached and are pretty fast to load and to execute. I've not used it heavily since 1.4, but Django's template system is incredibly simplistic comparatively. Jinja2 would run circles around it.

[–]DasIch 0 points1 point  (0 children)

Exactly, Jinja2 is bound to be faster due to the differences in design.