Repository navigation
Avoid .clear() in ArrayVec Drop if T doesn't need to drop - #330
Merged
Merged
Conversation
Owner
|
Thanks for the measurements and the change! I need to make a release, do poke me if it's not done within a week. |
Contributor
Author
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.
before the PR, a Drop of ArrayVec still did some work even if T doesn't need to drop: it did
self.set_len(0)which LLVM didnt optimize.In my use case, I use ArrayVec in many functions with lots of generics and skipping this set_len reduce my binary size by 4K.
I assume this can also affect performance in some extreme cases, but i didnt (try to) measure it. It saves 3 instructions on my mac.
thanks for the support, love the library! ❤️