You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
386 B
23 lines
386 B
#![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);
|
|
});
|
|
}
|