bytes
bytes copied to clipboard
Simplify <Vec<u8> as BufMut>::bytes_mut()
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.
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.
@danburkert Could you resolve merge conflicts?