Opened 7 years ago
Closed 7 years ago
#28642 closed Cleanup/optimization (fixed)
Add LRU caching to parse_accept_lang_header
Reported by: | Tom Forbes | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Re: https://github.com/django/django/pull/9116#issuecomment-332368698
I think utils.translation.trans_real.parse_accept_lang_header
would benefit from having a lru_cache
added to it, because the single input is quite regular, and while the function isn't supremely complex it does do a few things (regex split, float casting, sorting based on key) for every request.
The function currently returns a list, this would need to be changed to a tuple.
Change History (2)
comment:1 by , 7 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In f1c007bb: