-
-
Notifications
You must be signed in to change notification settings - Fork 759
perf(allocator/vec): remove SetLenOnDrop
#11079
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
perf(allocator/vec): remove SetLenOnDrop
#11079
Conversation
CodSpeed Instrumentation Performance ReportMerging #11079 will not alter performanceComparing Summary
|
Dunqing
left a comment
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.
Looks good! Your comments let me know better what SetLenOnDrop is going on.
Merge activity
|
290ae50 to
2f05c54
Compare
4bf146c to
b239cb0
Compare
b239cb0 to
6a14896
Compare
|
I'll fix the Miri fail. It appears not to be due to Miri flagging UB, but due to lint errors which have been added on nightly. |
|
Miri fail was unrelated. Fixed in #11092. |
6a14896 to
cfad6c4
Compare
Simplify `Vec::truncate` and `Vec::extend_with` methods. Unlike standard library, our `Vec<'a, T>` requires that `T` is not `Drop`. Therefore we don't need to worry about dropping elements. There are likely many more places where we can make similar simplifications (optimizations). I've only done these 2 now in order to get rid of `SetLenOnDrop`. I wanted to get rid of it because it requires direct access to `self.buf.len`, which I'd like to make private in a later PR.
cfad6c4 to
a6057c7
Compare

Simplify
Vec::truncateandVec::extend_withmethods.Unlike standard library, our
Vec<'a, T>requires thatTis notDrop. Therefore we don't need to worry about dropping elements.There are likely many more places where we can make similar simplifications (optimizations). I've only done these 2 now in order to get rid of
SetLenOnDrop. I wanted to get rid of it because it requires direct access toself.buf.len, which I'd like to make private in a later PR.