Just to chip in here... when TEMPLATE_DEBUG=True the template engine uses a
substantially different Lexer, based on re.finditer() instead of re.split().

There are about 10 hooks in the Parser class, too, that exist almost
exclusively to allow the DebugParser to change behavior.

If we always store the debug information [and do all the other parsing
checks] it's likely the template parsing will become _faster_, just because
of avoiding method calls.

For giggles, I'll run up a fork and see if I can get some meaningful
results from Preston's very welcome template benchmark tool.

--
Curtis


On 17 February 2015 at 16:03, Preston Timmons <prestontimm...@gmail.com>
wrote:

> Here are some benchmarks I added here:
>
> https://github.com/prestontimmons/templatebench
>
> This is the cumulative time to do 1000 iterations:
>
> Basic.do_init: 0.1423451900
> BasicDebug.do_init: 0.1941769123
> 35% increase in parsing time
>
> Basic.do_parse_complex: 1.2230978012
> BasicDebug.do_parse_complex: 1.4190740585
> 15.5% increase in parsing time
>
> FileSystem.do_get_template_complex: 1.4923889637
> FileSystemDebug.do_get_template_complex: 1.7524909973
> 17.4% increase in parsing time
>
> FileSystem.do_get_template_index: 0.5193221569
> FileSystemDebug.do_get_template_index: 0.5603711605
> 9.8% increase
>
> If my benchmarks are right, the increase is measurable, although probably
> not enough to notice in most usage of Django templates. Increasing parsing
> time isn't ideal, though, since that's where Django templates seems to
> spend most of their cpu time.
>
>>   --
> 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-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@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/9cc2bb2d-0335-4d49-8529-9c3dbdd07467%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/9cc2bb2d-0335-4d49-8529-9c3dbdd07467%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@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/CAG_XiSAtfngAGb9TKhugJuxg%2B6Og50%2BMP3V25kfZACuaMwsqiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to