#2594: Template system should handle whitespace better
-------------------------------------+-------------------------------------
     Reporter:  Gary Wilson          |                    Owner:  jshedd
  <gary.wilson@…>                    |                   Status:  new
         Type:  Bug                  |                  Version:  master
    Component:  Template system      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  1
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by leonov):

 I've spent the morning updating the patch against the latest development
 version.

 It was fairly straightforward, except for the `Lexer.create_token()`
 method, which took some time.  It was already fairly hairy in 1.4, and the
 addition of the `verbatim` tag in 1.5-dev had made it even more so.  I've
 added comments to make it easier for the next person to unravel the logic.

 All tests pass, pre- and post-patch, and the results of Gary Wilson's
 benchmark remain good.

 {{{
 python -m timeit -n500 -s 'from bm import my_render' 'my_render()'

 Without patch:
 500 loops, best of 3: 1.96 msec per loop
 500 loops, best of 3: 1.95 msec per loop
 500 loops, best of 3: 1.96 msec per loop

 With patch, TEMPLATE_STRIP_LEADING_WHITESPACE = True:
 500 loops, best of 3: 1.96 msec per loop
 500 loops, best of 3: 1.96 msec per loop
 500 loops, best of 3: 1.97 msec per loop

 With patch, TEMPLATE_STRIP_LEADING_WHITESPACE = False:
 500 loops, best of 3: 1.99 msec per loop
 500 loops, best of 3: 2 msec per loop
 500 loops, best of 3: 2.01 msec per loop
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/2594#comment:46>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to