-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Optimize vec.truncate and destructors for types with no dtor at -O0 #17633
Comments
Maybe |
It's already optimized out when optimizations are enabled. These loops could use |
|
@bvssvni Even just O1 isn't reasonable for development? |
It would be nice if adding a profile to Cargo.toml was not required for a such simple case. |
Would it make sense to have cargo default to O1? |
@rust-slacker: LLVM only fully supports debugging at |
This significantly improves the performance of `Vec::truncate` for types without destructors when building with `--opt-level=0` or `--opt-level=1`. Fixes rust-lang#17633.
Closing; I don't think we necessarily want to do this. |
Fun fact: I may or may not have spent a few hours banging my head against performance issues that ultimately were resolved by replacing a truncate with a set_len. (See this commit) Yeah, I know the optimizer is supposed to handle it, and in a perfect world that would be it, but...
|
The internal representation of String is
Vec<u8>
, butvec.truncate
loops to drop members.Perhaps setting the length directly?
The text was updated successfully, but these errors were encountered: