Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dqhl76 committed Nov 4, 2024
1 parent e269079 commit 9f3486c
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions core/benches/types/concurrent_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,34 @@ pub fn bench_concurrent_tasks(c: &mut Criterion) {
let mut group = c.benchmark_group("bench_concurrent_tasks");

for concurrent in [1, 2, 4, 8, 16] {
group.bench_with_input(format!("concurrent {}",concurrent), &concurrent, |b, concurrent| {
b.to_async(&*TOKIO).iter_batched(
|| {
ConcurrentTasks::new(Executor::new(), *concurrent, |()| {
Box::pin(async {
tokio::time::sleep(Duration::from_millis(1)).await;
((), Ok(()))
group.bench_with_input(
format!("concurrent {}", concurrent),
&concurrent,
|b, concurrent| {
b.to_async(&*TOKIO).iter_batched(
|| {
ConcurrentTasks::new(Executor::new(), *concurrent, |()| {
Box::pin(async {
tokio::time::sleep(Duration::from_millis(1)).await;
((), Ok(()))
})
})
})
},
|mut tasks| async move {
for _ in 0..100 {
let _ = tasks.execute(()).await;
}
},
|mut tasks| async move {
for _ in 0..100 {
let _ = tasks.execute(()).await;
}

loop {
if tasks.next().await.is_none() {
break;
loop {
if tasks.next().await.is_none() {
break;
}
}
}
},
BatchSize::PerIteration,
)
});
},
BatchSize::PerIteration,
)
},
);
}

group.finish()
Expand Down

0 comments on commit 9f3486c

Please sign in to comment.