mirror of
https://github.com/tokio-rs/bytes
synced 2024-10-18 22:02:26 +00:00
6a3d20bb8d
If `shallow_clone` is called with `&mut self`, and `Bytes` contains `Vec`, then expensive CAS can be avoided, because no other thread have references to this `Bytes` object. Bench `split_off_and_drop` difference: Before the diff: ``` test split_off_and_drop ... bench: 91,858 ns/iter (+/- 17,401) ``` With the diff: ``` test split_off_and_drop ... bench: 81,162 ns/iter (+/- 17,603) ``` |
||
---|---|---|
.. | ||
bytes.rs |