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 encoding selection for compression middleware #471

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

jplatte
Copy link
Collaborator

@jplatte jplatte commented Feb 17, 2024

Motivation

I noticed that Encoding::from_headers unnecessarily allocates a Vec for all the supported encodings it finds before selecting the most suitable one of them.

Solution

Change encodings to return an iterator and only collect that iterator where it makes sense.

@jplatte jplatte requested a review from Nehliin February 17, 2024 13:53
@jplatte jplatte merged commit 853f3e9 into main Feb 19, 2024
11 checks passed
@jplatte jplatte deleted the jplatte/supported-encodings-opt branch February 19, 2024 12:44
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.

2 participants