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

optimize cookie handling in request #459

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

nnnkkk7
Copy link
Contributor

@nnnkkk7 nnnkkk7 commented Jan 8, 2024

This PR optimizes the way we handle cookies in the request.

Previously, we were calling r.Cookies() twice and using append to add each cookie to a slice. This could potentially lead to unnecessary overhead due to the function calls and the automatic resizing of the slice when using append.

The new implementation only calls r.Cookies() once and uses indexing to set each element in the slice, which should be more efficient.

This change should not affect the functionality of the code, but it should improve its performance.

Signed-off-by: nnnkkk7 <kurodanaoki0711pana@gmail.com>

Signed-off-by: nnnkkk7 <kurodanaoki0711pana@gmail.com>
@dunglas
Copy link
Owner

dunglas commented Jan 8, 2024

Good catch, thanks!

@dunglas dunglas merged commit 3692818 into dunglas:main Jan 8, 2024
25 of 27 checks passed
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.

None yet

2 participants