#25491: django.utils.regex_helper.normalize should cache results locally
-------------------------------------+-------------------------------------
     Reporter:  atl-gmathews         |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Utilities            |                  Version:  1.8
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by atl-gmathews):

 Replying to [comment:1 knbk]:
 > Even if it provides a performance boost for patterns that are reused
 multiple times, the difference will be minimal at best, and it won't
 affect any requests after the `RegexURLResolver` has cached the normalized
 patterns.

 You're correct that `_populate()` only gets called once, and I was basing
 my assertion that `normalize()` is called for each `reverse()` on old
 code.

 But I'm seeing a large performance difference between cached and uncached
 `normalize()` in that one `_populate()` call during a normal request:

 Uncached: 1000ms (57.2% of total time); 1400 calls
 Cached: 5ms (0.89% of total time); 1400 calls

--
Ticket URL: <https://code.djangoproject.com/ticket/25491#comment:3>
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 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.35dd72674d06efb652ad23ecf7e3f7a3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to