Skip to content

Commit

Permalink
Benchmark packet-sized application datagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith authored and djc committed Nov 16, 2019
1 parent 16c3f25 commit ec57604
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions quinn/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ fn throughput(c: &mut Criterion) {
thread.join().unwrap();
}

{
let (addr, thread) = ctx.spawn_server();
let (client, mut runtime) = ctx.make_client(addr);
let data = Bytes::from(&[0xAB; 1182][..]);
group.throughput(Throughput::Bytes(data.len() as u64));
group.bench_function("medium datagrams", |b| {
b.iter(|| {
runtime.block_on(async {
client.send_datagram(data.clone()).await.unwrap();
});
})
});
drop(client);
runtime.run().unwrap();
thread.join().unwrap();
}

group.finish();
}

Expand Down

0 comments on commit ec57604

Please sign in to comment.