Opened 10 years ago
Closed 9 years ago
#24720 closed Cleanup/optimization (fixed)
using middleware.common to append slashes causes extra overhead to all requests that do not end in a slash
Reported by: | Jay Cox | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | optimization middleware common |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Checking if a url is valid is just as costly as fully resolving the url, so when the common middleware checks if it should append a slash it is fully doubling the url resolution overhead (which is about 5%) (this overhead only applies to urls that do not already end in a slash)
By deferring the checks until the process_response phase we can make sure that we only pay the price for urls that actually need a slash appended (that is to say would actually return a 404).
Pull request:
https://github.com/django/django/pull/4574
Change History (4)
comment:1 by , 10 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 9 years ago
Patch needs improvement: | unset |
---|
comment:3 by , 9 years ago
Needs documentation: | set |
---|
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
In 434d309e: