-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Check whether vector value needs to be dropped in Vec#truncate #57949
Check whether vector value needs to be dropped in Vec#truncate #57949
Conversation
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
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.
LGTM and I think the severe O0 performance hit is worth fixing. Let me run it by one other person since this involves unsafe code:
I'm personally wary and would prefer to not land changes like this in libstd at this time. I understand the tradeoff and how this performs much better at O0, but there are a number of aspects which give me pause:
Our somewhat ad-hoc-ly developed policy (AFAIK) is that we don't accept O0-only improvements into libstd, and I'd prefer to stick to that unless we can develop a policy to encompass more than just a handful of functions in libstd. |
Agreed. Even then, I don't think it's a bad idea to do that in places that can benefit from it, even if there is much more to do.
Mostly because users actually workaround around that one. See kmeisthax/rapidtar@92f4af2
I.e. having more tokens in a source code slows down compilation. This is technically true, although mostly meaningless. |
0813128
to
9f0ca59
Compare
I undertand how this would make linked code like above no longer necessary, but I continue to feel that this is not something we should do in libstd. Despite this being localized, this can easily snowball and has questionable value in returns. We've basically never tried to develop idioms for Rust where O0 runtime is fast, O0 is basically optimized for compile time speed and that's it. Given basically any slow part of libstd that gets optimized away we can generate a program that "too slow" at O0, so I'm not sure we can place too much weight on any one example. |
@xfix Is it possible your most recent force-push had the wrong content? This looks like a different change. |
9f0ca59
to
0813128
Compare
Yes, that's what happened. |
0813128
to
39ee117
Compare
ping from triage @alexcrichton awaiting your review on this |
I don't foresee Alex's perspective changing. #57949 (comment) are strong arguments. |
Fixes #17633.