Skip to content

Commit 25b4414

Browse files
committed
feat(udp/bench): support recvmmsg
1 parent 51ef00c commit 25b4414

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

quinn-udp/benches/throughput.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
use criterion::{criterion_group, criterion_main, Criterion};
88
use tokio::{io::Interest, runtime::Runtime};
99

10-
use quinn_udp::{RecvMeta, Transmit, UdpSocketState};
10+
use quinn_udp::{RecvMeta, Transmit, UdpSocketState, BATCH_SIZE};
1111

1212
pub fn criterion_benchmark(c: &mut Criterion) {
1313
const TOTAL_BYTES: usize = 10 * 1024 * 1024;
@@ -39,12 +39,17 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3939
continue;
4040
}
4141

42-
permutations.push((gso_enabled, gro_enabled));
42+
for recvmmsg_enabled in [false, true] {
43+
permutations.push((gso_enabled, gro_enabled, recvmmsg_enabled));
44+
}
4345
}
4446
}
4547

46-
for (gso_enabled, gro_enabled) in permutations {
47-
let mut group = c.benchmark_group(format!("gso_{}_gro_{}", gso_enabled, gro_enabled));
48+
for (gso_enabled, gro_enabled, recvmmsg_enabled) in permutations {
49+
let mut group = c.benchmark_group(format!(
50+
"gso_{}_gro_{}_recvmmsg_{}",
51+
gso_enabled, gro_enabled, recvmmsg_enabled
52+
));
4853
group.throughput(criterion::Throughput::Bytes(TOTAL_BYTES as u64));
4954

5055
let gso_segments = if gso_enabled {
@@ -65,7 +70,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
6570
} else {
6671
1
6772
};
68-
let batch_size = 1;
73+
let batch_size = if recvmmsg_enabled { BATCH_SIZE } else { 1 };
6974

7075
group.bench_function("throughput", |b| {
7176
b.to_async(&rt).iter(|| async {

0 commit comments

Comments
 (0)