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

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.

GZip: map on the F response, not the `Kleisli`.
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.
@jmcardon
Copy link
Member

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.

@rossabaker

This comment has been minimized.

Copy link
Member

commented May 22, 2019

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

@aeons aeons merged commit 23151db into http4s:master May 22, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@diesalbla

This comment has been minimized.

Copy link
Contributor Author

commented May 22, 2019

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

@rossabaker

This comment has been minimized.

Copy link
Member

commented May 22, 2019

Oh, in its implementation. You're right.

I told you I was bad at counting allocations. 😄

@diesalbla diesalbla deleted the diesalbla:gzip_tweak_map_on_f branch May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.