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.
This helps with #7 , but doesn't necessarily close it (might be more places that should be inlined).
This PR adds the
#[inline]
attr to some theByteSlice
andByteSliceMut
trait impls, along with thealigned_to
util fn, which otherwise seem to not get inlined, though they probably should. Tested this on yesterday's nightly, and latest stable. Evenlto = "fat"
andcodegen-units = 1
weren't helpful here.I only saw concrete need for inlining in the
ByteSlice
impl for&[u8]
, but added it for the rest of the impls because it seemed likely they might suffer from the same thing.The second commit in this PR (which is independent from the first one) just coalesces
ByteSlice::as_ptr
andByteSliceMut::as_mut_ptr
into provided default impls on the trait declarations. This allows for less repetition and I think was originally an oversight, but I can revert it if it's undesired.Reproduction code (should be in external crate):
Assembly before this PR:
Assembly after this PR: