You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: compile BCP 47 language tag regex once at package init
isValidBCP47StrictLanguageTag was calling regexp.MustCompile on a
complex, constant pattern on every invocation. Since this function is
called for every language tag key in the description map and every
entry in availableLanguages, a single parse could trigger 10-50+
compilations of the same regex, each non-trivial due to its size.
Move the regex to a package-level var so it is compiled once.
0 commit comments