-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
libtest bench async/await support #71186
Comments
Which executor would |
I think this is major enough that we would need an RFC for it; it essentially means offering some executor in std/test. I suspect, though could also be wrong, that in particular for benchmarking that could be a bad idea (since you'd be benchmarking at least partially your executor, and std's is unlikely to be best-in-class for your specific problem). |
@jonas-schievink I believe any executor can be used, I just don't want to create async runtime in bench iterator, because it will influence the result. Instead of creating an async runtime in every bench iterator, why not create just one runtime and spawn tasks on it? |
Or maybe bencher should be sperated into a crate so that we can use different runtime. I found one but it's not maintained |
I think we can also let b.iter_async_with(tokio::runtime::Runtime::new().unwrap(), async {
// async call
}) Currently it's a pain to benchmark async code.... |
also the [bench] attribute doesn't support async function. |
Since the executor needs to be used inside the iter closure, the results don't reflect fully the performance of running source, but also the resources needed by the futures executor to await for the results. It seems like using async/await in benches is still WIP (see issue: rust-lang/rust#71186)
@Stargateur any progress on this? |
can libtest offer
b.iter_async
to make it possible to run async functions?because it seems if we are using
aynsc_std::task::block_on
or other runtime, that may influence the resultThe text was updated successfully, but these errors were encountered: