-
Notifications
You must be signed in to change notification settings - Fork 275
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
Should clone benchmark use use test::blackbox
?
#690
Comments
That sounds like a reasonable suggestion. |
wyfo
added a commit
to wyfo/bytes
that referenced
this issue
Apr 10, 2024
Closes tokio-rs#690 Without it, it seemed to me that compiler was able to inline the vtable, resulting in similar results for `clone_shared` and `clone_arg_vec`.
wyfo
added a commit
to wyfo/bytes
that referenced
this issue
Apr 10, 2024
Closes tokio-rs#690 Without it, it seems to me that compiler is able to inline the vtable, resulting in similar results for `clone_shared` and `clone_arg_vec`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?The text was updated successfully, but these errors were encountered: