>
> After a while I believe layers and layers of caution have accrued, and 
> nobody is sure any more where these have overlapped excessively.
>

Do you have examples of which layers these are?

Escaping seems to happen in Variable, VariableNode, FilterExpression, and 
render_value_in_context. I don't see a lot of work being done twice there.

If you think the escape implementation is slow, though, it wouldn't be hard 
to simply remove that and benchmark with no escape code running. That would 
at least reveal the theoretical limit to which the escape code could be 
improved.

On another note, in my benchmark I see the difference to render a somewhat 
complex template between Django and Jinja2 at 8-9 times.

>From one run, just grabbing the minimum time to render a template:

Django: 9.08e-05
Jinja2: 1.38e-05

The big difference here is because Django uses a recursive node-based 
renderer, whereas Jinja2 just translates the template into Python. That 
means a lot less overhead when rendering happens.

Optimizing Django rendering means either:

1) Identifying the nodes which are a bottleneck and reducing the work they 
do
2) Replacing node rendering with something that's faster.

Option 2 probably has the biggest opportunity for gain, but it would 
require some real creativity to maintain backwards-compatibility with 
existing tags.

Preston

-- 
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 [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/957b9840-b537-4861-9390-e7b6f44dd72c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to