perf(allocator/vec): remove SetLenOnDrop#11079
Merged
graphite-app[bot] merged 1 commit intomainfrom May 17, 2025
Merged
Conversation
This was referenced May 16, 2025
This was referenced May 16, 2025
Member
Author
CodSpeed Instrumentation Performance ReportMerging #11079 will not alter performanceComparing Summary
|
This was referenced May 16, 2025
Dunqing
reviewed
May 16, 2025
Dunqing
approved these changes
May 16, 2025
Member
Dunqing
left a comment
There was a problem hiding this comment.
Looks good! Your comments let me know better what SetLenOnDrop is going on.
This was referenced May 16, 2025
Member
Author
Merge activity
|
290ae50 to
2f05c54
Compare
4bf146c to
b239cb0
Compare
b239cb0 to
6a14896
Compare
Member
Author
|
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. |
Merged
Member
Author
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.