#28828: Performance improvements for HttpRequest.build_absolute_uri()
-------------------------------------+-------------------------------------
Reporter: gcbirzan | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Keryn Knight):
* stage: Accepted => Ready for checkin
Comment:
Anecdata verifying the improvement, using the following code against
Python 3.5.1 on OSX:
{{{
from django.test.client import RequestFactory
import timeit
request = RequestFactory().get('/')
timeit.timeit("request.build_absolute_uri(location='///foo/bar/')",
number=1000000, globals={'request': request})
request = RequestFactory().get('/')
timeit.timeit("request.build_absolute_uri(location='/foo/./bar/')",
number=1000000, globals={'request': request})
}}}
Master as of `d60e8b856b49922deb85a168e48e56f16facd5df` consistently
yields **50.x-51.x seconds** for each timeit usage.
PR yields **9 seconds** for the `///foo/bar/` case, and **33 seconds** for
the less common `/foo/./bar/` case.
--
Ticket URL: <https://code.djangoproject.com/ticket/28828#comment:5>
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/066.e567d9419deef1ebbccc3b67bd4c946a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.