Skip to content

Make some functions less-generic to reduce binary bloat #503

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

Merged
merged 12 commits into from
Feb 18, 2021

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented Dec 22, 2020

Didn't see #484 until after the fact so I can remove that commit if desired, it is arguably a cleaner separation though since it extracts a separate and private struct instead of passing multiple parameters.

Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very cool, thanks! Do you have any data on the difference this makes?

We're preparing a major (0.x minor?) release for tomorrow, so I'd prefer to merge this after, just to give a timeline.

@Marwes
Copy link
Contributor Author

Marwes commented Dec 23, 2020

Testing with and without this on hyper's http_proxy example which triggers two instantiatiations of decode_frame, etc. Gives a ~10% reduction in emitted LLVM IR

553979 / 610618 = 0.90724315366

@Marwes
Copy link
Contributor Author

Marwes commented Feb 16, 2021

Any chance of this getting merged?

@nox
Copy link
Contributor

nox commented Feb 16, 2021

@Marwes The two last commits can be removed, as #514 fixed the deprecation problem.

@Marwes Marwes force-pushed the minimize branch 3 times, most recently from f443750 to 6547af7 Compare February 17, 2021 11:43
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow review. I've finally gotten through most of it, and this is great stuff. I'm bummed the compiler cannot do this automatically, but I get it. A few thoughts inline.

@seanmonstar seanmonstar merged commit 30ca832 into hyperium:master Feb 18, 2021
@Marwes Marwes deleted the minimize branch February 18, 2021 20:04
BenxiangGe pushed a commit to BenxiangGe/h2 that referenced this pull request Jul 26, 2021
* refactor: Extract FramedWrite::buffer to a less generic function

Should cut out another 23 KiB (since I see it duplicated)

* refactor: Extract some duplicated code to a function

* refactor: Extract part of flush into a less generic function

* refactor: Extract a less generic part of connection

* refactor: Factor out a less generic part of Connection::poll2

* refactor: Extract a non-generic part of handshake2

* refactor: Don't duplicate Streams code on Peer (-3.5%)

The `P: Peer` parameter is rarely used and there is already a mechanism
for using it dynamically.

* refactor: Make recv_frame less generic (-2.3%)

* Move out part of Connection::poll

* refactor: Extract parts of Connection

* refactor: Extract a non-generic part of reclaim_frame

* comments
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.

3 participants