Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Check whether vector value needs to be dropped in Vec#truncate #57949
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.
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.