Skip to content
New issue

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

Fix skewed middleware benchmarks (#165) #166

Merged
merged 1 commit into from
Feb 9, 2024
Merged

Fix skewed middleware benchmarks (#165) #166

merged 1 commit into from
Feb 9, 2024

Conversation

jub0bs
Copy link
Contributor

@jub0bs jub0bs commented Feb 9, 2024

Fixes #165. I have not updated the Benchmarks section of the README (you may want to do that yourself after running the benchmarks on your own machine).

@rs
Copy link
Owner

rs commented Feb 9, 2024

The updated benchmark is, in fact, more skewed as it assumes the header map is not initialized. It allocates the first key to this library, whereas in reality all responses will inherently come with at least one header. I'm going to push a modified version of this PR with a header initialized. Thanks.

@rs rs merged commit eacc8e8 into rs:master Feb 9, 2024
@jub0bs
Copy link
Contributor Author

jub0bs commented Feb 10, 2024

@rs

Interesting. I'm not sure what a good middle ground would be. All I know is that CORS middleware typically get stacked at or close to the top (they're the first in the middleware chain to execute) and that the http.Header map used under the hood by http.ResponseWriter initially has zero capacity (no size hint).

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.

Middleware benchmarks are still skewed (follow-up to #156)
2 participants