We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The CORS middleware currently recompiles the same regexps over and over during each of its invocations. However, for performance, compiling regexps on the hot path should be avoided when possible.
In this case, the regexps could be compiled once and for all during middleware initialisation. The following line
allowOriginPatterns := []string{}
could advantageously be replaced by
var allowOriginRegexp []*regexp.Regexp
and the rest of the necessary changes would flow from this simple change.
No regexp compilation on the hot path.
Regexp compilation on the hot path.
v4.12.0
The text was updated successfully, but these errors were encountered:
Thanks for noticing. #2709 reworks that part
Sorry, something went wrong.
No branches or pull requests
Issue Description
The CORS middleware currently recompiles the same regexps over and over during each of its invocations. However, for performance, compiling regexps on the hot path should be avoided when possible.
In this case, the regexps could be compiled once and for all during middleware initialisation. The following line
could advantageously be replaced by
and the rest of the necessary changes would flow from this simple change.
Checklist
Expected behaviour
No regexp compilation on the hot path.
Actual behaviour
Regexp compilation on the hot path.
Version/commit
v4.12.0
The text was updated successfully, but these errors were encountered: