Template render performance

119 views
Skip to first unread message

cristia...@gmail.com

unread,
Nov 17, 2014, 9:20:15 PM11/17/14
to django-d...@googlegroups.com
Hello,

Mostly a question, but are there any work in progress to improve templates render performance? Times when having medium to big data and/or loops get excesively high, compared to jinja2 which sadly is not as easy to use as django native template language. I would really trade a feature or two in order to achieve better performance. For example, accessing variables from a dict, or even calling functions, all with the same syntax, I believe there's a huge overhead in there, and trading a xx.call for xx.call() is not such a big deal.

What about a high performance option inside a template which trades flexibility for performance.

Michael Manfre

unread,
Nov 17, 2014, 9:40:42 PM11/17/14
to django-d...@googlegroups.com
Thanks to the work Aymeric recently started, Django will have more options with regards to templating. See his DEP on Multiple Template Engines. https://myks.org/en/multiple-template-engines-for-django/dep/

Regarding changing the Django Template Language syntax for the sake of performance improvements, backwards incompatible changes are not likely to happen. There is a huge cost involved with forcing everyone to update their templates. Ideas on improvements that are backwards compatible would be welcomed by many!

Regards,
Michael Manfre


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
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/546aacd0.caa7340a.6c15.29a8%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Curtis Maloney

unread,
Nov 18, 2014, 3:19:05 AM11/18/14
to django-d...@googlegroups.com
It's been on my TODO list for some time to deep dive into DTL and find where I can to remove excess work.

There's a LOT of defensive coding in there to ensure things are what we expect, and to handle cases "just in case", and I've a gut feeling [nothing more] that we can remove some of these safety catches.

However, to do this I would first require a credible template benchmark suite.

It's been my experience that it's actually quite rare for the slowdowns to be unavoidably DTLs fault... often a tiny more work in the view to put data into better structures can affect drastic speedups.

So, in closing... if you're interested in helping me help you... let's talk.

--
Curtis


poswald

unread,
Nov 18, 2014, 9:31:31 PM11/18/14
to django-d...@googlegroups.com
Not going to weigh in on if this is worth it or not, but if you're interested and are looking for a way to set up a rendering speed benchmark, this is the approach that floppyforms took to sanity check their changes:

Reply all
Reply to author
Forward
0 new messages