revert #7#11
Conversation
| /// b.iter(|| { | ||
| /// println!("hello world"); | ||
| /// }) | ||
| /// println!("hello world"); |
There was a problem hiding this comment.
This is now part of the macro again, unfortunately.
|
I did some more thinking on
So we're forced to do something like: b.iter(|| task::block_on(async {}));This is silly if our microbenchmark is defined as: #[async_attributes::bench]
async fn foo(b: &mut Bencher) {
b.iter(|| task::block_on(async {}));
}Which means we have an I think a more ideal interface for b.iter_async(async {}).await;Unfortunately, I'm going back and forth on how we should hack around these limitations. There is no good solution, but perhaps this would be the best one right now: #[bench]
#(#attrs)*
fn #name(b: &mut test::Bencher) {
let _ = b.iter(|| async_std::task::block_on(async { #body }));
} |
|
Also, let's add a simple benchmark just for CI/testing purposes :) use std::time::Duration;
use async_std::task;
#[async_attributes::bench]
async fn sleep() {
task::sleep(Duration::from_micros(100)).await;
} |
Reverts #7 as per #9. Thanks!