-
Notifications
You must be signed in to change notification settings - Fork 12
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
#[bench] attribute dose not work #9
Comments
The error here is related to proc-macro, but if we fix it, it still doesn't work.
This is because The code generated at this time is as follows: #[bench]
fn bench(b: &mut test::Bencher) {
task::block_on(task::spawn(async {
b.iter(|| {
println!("hello world");
})
}))
} (This doesn't seem to work even if |
So the way described in async-rs/async-std#70 (comment) may not work until scoped spawn API is implemented. |
@taiki-e thanks so much for tracking this down. I think probably the best course of action here would be to revert for now and revisit this later? Also could you perhaps clarify what you mean by "scoped spawn API"? I feel like I've heard it before but can't quite recall what it means. |
Yeah, for now, I think this needs to be reverted. Also, since #[bench]
fn benchmark(b: &mut Bencher) {
task::block_on(task::spawn(async {
b.iter(|| {
// `await` is only allowed inside `async` functions and blocks.
// So, we need to make a future in `b.iter(..)`.
})
}))
}
stjepang/async-std-old#39 |
I still got |
Totally agree with @taiki-e |
The current
#[bench]
attribute is broken because #7 was merged without testing.code:
error:
The text was updated successfully, but these errors were encountered: