-
-
Notifications
You must be signed in to change notification settings - Fork 303
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
Conversation
There was a problem hiding this 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.
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 |
4b024aa
to
46b285d
Compare
Any chance of this getting merged? |
f443750
to
6547af7
Compare
Should cut out another 23 KiB (since I see it duplicated)
The `P: Peer` parameter is rarely used and there is already a mechanism for using it dynamically.
There was a problem hiding this 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.
* 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
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.