Skip to content
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

Simplify <Vec<u8> as BufMut>::bytes_mut() #442

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danburkert
Copy link
Contributor

Removes a call to UninitMut indexing, which can panic, from
Vec::<u8>::bytes_mut(). I came across this while looking at a
performance issue encountered after moving to bytes 0.6. This change
makes a microbenchmark in prost slightly faster, although there's
still a big delta between 0.5 and 0.6. See danburkert/prost#381.

Removes a call to UninitMut indexing, which can panic, from
`Vec::<u8>::bytes_mut()`.  I came across this while looking at a
performance issue encountered after moving to bytes 0.6. This change
makes a microbenchmark in `prost` slightly faster, although there's
still a big delta between 0.5 and 0.6. See danburkert/prost#381.
@danburkert
Copy link
Contributor Author

Added a second commit which adds an #[inline] for Vec::put_slice, which closed most of the remaining perf difference between 0.5 and 0.6. Will have another PR to add inlines to UninitSlice to close out the rest.

Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@taiki-e
Copy link
Member

taiki-e commented Apr 10, 2021

@danburkert Could you resolve merge conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants