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

GZip: map on the F response, not the Kleisli. #2590

Merged
merged 1 commit into from May 22, 2019

Conversation

@diesalbla
Copy link
Contributor

@diesalbla diesalbla commented May 21, 2019

A small performance tweak in GZip: instead of doing the map on Kleisli.map, which would create a new Kleisli every time, we first apply to the request, then map on the F[Response] directly.

A small performance tweak in GZip: instead of doing the `map` on
Kleisli.map, which would create a new Kleisli every time,
we do the `map` on the `F[Response]` directly.
Copy link
Member

@jmcardon jmcardon left a comment

I'm going to approve this: It's not just a new Kleisli, but a new closure that does a => map internally for it to work. This saves on a whole 2 allocations.

Loading

@rossabaker
Copy link
Member

@rossabaker rossabaker commented May 22, 2019

I'm not very good at counting allocations, but I think the .map on F gives one allocation back.

Loading

@aeons aeons merged commit 23151db into http4s:master May 22, 2019
1 check passed
Loading
@diesalbla
Copy link
Contributor Author

@diesalbla diesalbla commented May 22, 2019

Of course, but the Kleisli.map method also uses the Functor[F].map.

Loading

@rossabaker
Copy link
Member

@rossabaker rossabaker commented May 22, 2019

Oh, in its implementation. You're right.

I told you I was bad at counting allocations. 😄

Loading

@diesalbla diesalbla deleted the gzip_tweak_map_on_f branch May 22, 2019
rossabaker added a commit to rossabaker/http4s that referenced this issue Apr 3, 2020
Change string interpolator macros to use unsafe methods to avoid
triggering Wartremover EitherProjectionPartial warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants