#28642: Add LRU caching to parse_accept_lang_header ------------------------------------------------+------------------------ Reporter: Tom | Owner: nobody Type: Cleanup/optimization | Status: new Component: Internationalization | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 1 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ------------------------------------------------+------------------------ 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. -- Ticket URL: <https://code.djangoproject.com/ticket/28642> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/046.38cc7479db50ae7d8f1eb0f8cf66d208%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.