rustdesk/vendor/async-task/benches/spawn.rs

23 lines
386 B
Rust
Raw Normal View History

2024-10-11 18:43:02 +03:00
#![feature(test)]
extern crate test;
use smol::future;
use test::Bencher;
#[bench]
fn task_create(b: &mut Bencher) {
b.iter(|| {
let _ = async_task::spawn(async {}, drop);
});
}
#[bench]
fn task_run(b: &mut Bencher) {
b.iter(|| {
let (runnable, task) = async_task::spawn(async {}, drop);
runnable.run();
future::block_on(task);
});
}