-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Consider inlining Poll::map
, Poll::map_ok
and Poll::map_err
#101080
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
Comments
That's surprising. Can you share your project? |
@saethlin Unfortunately, it is a private project, I cannot share it. |
Ah okay. I find it suspicious that these functions aren't inlining already. Did you try building your project against a modified standard library with Do you still get a code size improvement from manual inlining if you compile with How big are these functions once they are compiled in your crate? The third-party tool
(of course trimming that down a bit if there are type names in there you don't want to fully disclose) |
@saethlin I have done some tests on my project, using
All configurations above are using
|
What about If that configuration gets these functions inlined I think this is worth doing because it unlocks additional useful optimizations for users, but if the optimization is gated behind @nikic Do you or any other LLVM folks have insight into why |
@saethlin: It seems that changing standard library source code only works with |
That's what I do. It's a very slow workflow. |
…-Simulacrum Inline `Poll` methods With `opt-level="z"`, the `Poll::map*` methods are sometimes not inlined (see <https://godbolt.org/z/ca5ajKTEK>). This PR adds `#[inline]` to these methods. I have a project that can benefit from this change, but do we want to enable this behavior universally? Fixes rust-lang#101080.
I noticed that in one of my project, inlining
Poll::map
manually reduces some binary size, then I noticedPoll::map
is not marked#[inline]
. Since bothOption::map
andResult::map
are marked#[inline]
, I wonder whether this is an oversight. I failed to reproduce the binary size reduction effect with an example code, but maybe the reason behind inliningOption::map
andResult::map
also applies toPoll::map
? How aboutPoll::map_ok
andPoll::map_err
?The text was updated successfully, but these errors were encountered: