I've recently run the bytes.rs benchmarks, and was quite surprised that clone_shared was identical to clone_arc_vec. That should not be the case with the indirection caused by the vtable.
Actually, the compiler seems to be smart enough to inline the vtable, hence this result (I haven't checked on godbolt because the library feature is broken).
However, if we replace &bytes.clone() by test::black_box(test::black_box(&bytes).clone()), a (small) difference appears, and I think it should be more representative of arbitrary code in which bytes can be used. Is it a good idea to update the benchmarks?
I've recently run the
bytes.rs
benchmarks, and was quite surprised thatclone_shared
was identical toclone_arc_vec
. That should not be the case with the indirection caused by the vtable. Actually, the compiler seems to be smart enough to inline the vtable, hence this result (I haven't checked on godbolt because the library feature is broken).However, if we replace
&bytes.clone()
bytest::black_box(test::black_box(&bytes).clone())
, a (small) difference appears, and I think it should be more representative of arbitrary code in whichbytes
can be used. Is it a good idea to update the benchmarks?