1
0
Fork 0
firefox/third_party/rust/async-task/benches/spawn.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

22 lines
386 B
Rust

#![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);
});
}