1 #![feature(test)] 2 3 extern crate test; 4 5 use smol::future; 6 use test::Bencher; 7 8 #[bench] task_create(b: &mut Bencher)9fn task_create(b: &mut Bencher) { 10 b.iter(|| { 11 let _ = async_task::spawn(async {}, drop); 12 }); 13 } 14 15 #[bench] task_run(b: &mut Bencher)16fn task_run(b: &mut Bencher) { 17 b.iter(|| { 18 let (runnable, task) = async_task::spawn(async {}, drop); 19 runnable.run(); 20 future::block_on(task); 21 }); 22 } 23