summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/benches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /third_party/rust/neqo-transport/benches
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/neqo-transport/benches')
-rw-r--r--third_party/rust/neqo-transport/benches/range_tracker.rs16
-rw-r--r--third_party/rust/neqo-transport/benches/rx_stream_orderer.rs4
-rw-r--r--third_party/rust/neqo-transport/benches/transfer.rs16
3 files changed, 21 insertions, 15 deletions
diff --git a/third_party/rust/neqo-transport/benches/range_tracker.rs b/third_party/rust/neqo-transport/benches/range_tracker.rs
index c2f78f4874..ee611cf4ea 100644
--- a/third_party/rust/neqo-transport/benches/range_tracker.rs
+++ b/third_party/rust/neqo-transport/benches/range_tracker.rs
@@ -11,30 +11,32 @@ const CHUNK: u64 = 1000;
const END: u64 = 100_000;
fn build_coalesce(len: u64) -> RangeTracker {
let mut used = RangeTracker::default();
- used.mark_acked(0, CHUNK as usize);
- used.mark_sent(CHUNK, END as usize);
+ let chunk = usize::try_from(CHUNK).expect("should fit");
+ used.mark_acked(0, chunk);
+ used.mark_sent(CHUNK, usize::try_from(END).expect("should fit"));
// leave a gap or it will coalesce here
for i in 2..=len {
// These do not get immediately coalesced when marking since they're not at the end or start
- used.mark_acked(i * CHUNK, CHUNK as usize);
+ used.mark_acked(i * CHUNK, chunk);
}
used
}
fn coalesce(c: &mut Criterion, count: u64) {
+ let chunk = usize::try_from(CHUNK).expect("should fit");
c.bench_function(
&format!("coalesce_acked_from_zero {count}+1 entries"),
|b| {
b.iter_batched_ref(
|| build_coalesce(count),
|used| {
- used.mark_acked(CHUNK, CHUNK as usize);
+ used.mark_acked(CHUNK, chunk);
let tail = (count + 1) * CHUNK;
- used.mark_sent(tail, CHUNK as usize);
- used.mark_acked(tail, CHUNK as usize);
+ used.mark_sent(tail, chunk);
+ used.mark_acked(tail, chunk);
},
criterion::BatchSize::SmallInput,
- )
+ );
},
);
}
diff --git a/third_party/rust/neqo-transport/benches/rx_stream_orderer.rs b/third_party/rust/neqo-transport/benches/rx_stream_orderer.rs
index 0a1e763e97..d58e11ee86 100644
--- a/third_party/rust/neqo-transport/benches/rx_stream_orderer.rs
+++ b/third_party/rust/neqo-transport/benches/rx_stream_orderer.rs
@@ -11,14 +11,14 @@ fn rx_stream_orderer() {
let mut rx = RxStreamOrderer::new();
let data: &[u8] = &[0; 1337];
- for i in 0..100000 {
+ for i in 0..100_000 {
rx.inbound_frame(i * 1337, data);
}
}
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("RxStreamOrderer::inbound_frame()", |b| {
- b.iter(rx_stream_orderer)
+ b.iter(rx_stream_orderer);
});
}
diff --git a/third_party/rust/neqo-transport/benches/transfer.rs b/third_party/rust/neqo-transport/benches/transfer.rs
index 444f738f9c..32959f6cb5 100644
--- a/third_party/rust/neqo-transport/benches/transfer.rs
+++ b/third_party/rust/neqo-transport/benches/transfer.rs
@@ -6,7 +6,7 @@
use std::time::Duration;
-use criterion::{criterion_group, criterion_main, BatchSize::SmallInput, Criterion};
+use criterion::{criterion_group, criterion_main, BatchSize::SmallInput, Criterion, Throughput};
use test_fixture::{
boxed,
sim::{
@@ -20,8 +20,11 @@ const ZERO: Duration = Duration::from_millis(0);
const JITTER: Duration = Duration::from_millis(10);
const TRANSFER_AMOUNT: usize = 1 << 22; // 4Mbyte
-fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<str>>) {
- c.bench_function(label, |b| {
+fn benchmark_transfer(c: &mut Criterion, label: &str, seed: &Option<impl AsRef<str>>) {
+ let mut group = c.benchmark_group("transfer");
+ group.throughput(Throughput::Bytes(u64::try_from(TRANSFER_AMOUNT).unwrap()));
+ group.noise_threshold(0.03);
+ group.bench_function(label, |b| {
b.iter_batched(
|| {
let nodes = boxed![
@@ -42,15 +45,16 @@ fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<impl AsRef<st
sim.run();
},
SmallInput,
- )
+ );
});
+ group.finish();
}
fn benchmark_transfer_variable(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with varying seeds",
- std::env::var("SIMULATION_SEED").ok(),
+ &std::env::var("SIMULATION_SEED").ok(),
);
}
@@ -58,7 +62,7 @@ fn benchmark_transfer_fixed(c: &mut Criterion) {
benchmark_transfer(
c,
"Run multiple transfers with the same seed",
- Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
+ &Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
);
}