Closed tisonkun closed 5 months ago
Ref - https://greptime.com/blogs/2024-04-09-rust-protobuf-performance#step-5-why-is-bytes-slice-so-slow
We already use this tech for BytesMut, but not bring it for Bytes. Namely, reduce the overhead of slice.
BytesMut
Bytes
impl Buf for BytesMut { ... fn copy_to_bytes(&mut self, len: usize) -> Bytes { self.split_to(len).freeze() } }
cc @Darksonn
@braddunbar shall we merge this patch? Or it's still wait for further reviews?
Thank you!
Thank you for the PR :)
Ref - https://greptime.com/blogs/2024-04-09-rust-protobuf-performance#step-5-why-is-bytes-slice-so-slow
We already use this tech for
BytesMut
, but not bring it forBytes
. Namely, reduce the overhead of slice.