Skip to content

perf(get-component): cache acceptLanguageParser.parse results#1480

Open
ricardo-devis-agullo wants to merge 1 commit into
masterfrom
perf/cache-accept-language-parser
Open

perf(get-component): cache acceptLanguageParser.parse results#1480
ricardo-devis-agullo wants to merge 1 commit into
masterfrom
perf/cache-accept-language-parser

Conversation

@ricardo-devis-agullo
Copy link
Copy Markdown
Collaborator

acceptLanguageParser.parse is called on every data-provider request with
the same Accept-Language header value. Since it's a pure function (same
input → same output), cache the result using the existing nice-cache instance
keyed by the raw header string.

This avoids repeated parsing of identical Accept-Language headers across
concurrent and sequential requests from the same browser.

acceptLanguageParser.parse is called on every data-provider request with
the same Accept-Language header value. Since it's a pure function (same
input → same output), cache the result using the existing nice-cache instance
keyed by the raw header string.

This avoids repeated parsing of identical Accept-Language headers across
concurrent and sequential requests from the same browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant