Skip to content

Commit

Permalink
benches: add "1 -> 16" bench function
Browse files Browse the repository at this point in the history
  • Loading branch information
hozan23 committed Jul 16, 2024
1 parent 48cfbd1 commit b04093c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions benches/broadcast_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,40 @@ pub fn broadcast_and_recv(c: &mut Criterion) {
})
})
});

let r9 = r1.clone();
let r10 = r1.clone();
let r11 = r1.clone();
let r12 = r1.clone();
let r13 = r1.clone();
let r14 = r1.clone();
let r15 = r1.clone();
let r16 = r1.clone();

c.bench_function("1 -> 16", |b| {
b.iter(|| {
block_on(async {
s.broadcast(n).await.unwrap();
assert_eq!(r1.recv().await.unwrap(), n);
assert_eq!(r2.recv().await.unwrap(), n);
assert_eq!(r3.recv().await.unwrap(), n);
assert_eq!(r4.recv().await.unwrap(), n);
assert_eq!(r5.recv().await.unwrap(), n);
assert_eq!(r6.recv().await.unwrap(), n);
assert_eq!(r7.recv().await.unwrap(), n);
assert_eq!(r8.recv().await.unwrap(), n);
assert_eq!(r9.recv().await.unwrap(), n);
assert_eq!(r10.recv().await.unwrap(), n);
assert_eq!(r11.recv().await.unwrap(), n);
assert_eq!(r12.recv().await.unwrap(), n);
assert_eq!(r13.recv().await.unwrap(), n);
assert_eq!(r14.recv().await.unwrap(), n);
assert_eq!(r15.recv().await.unwrap(), n);
assert_eq!(r16.recv().await.unwrap(), n);
n += 1;
})
})
});
}

criterion_group!(benches, broadcast_and_recv);
Expand Down

0 comments on commit b04093c

Please sign in to comment.