Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Oct 15, 2024
1 parent 025e604 commit 76cd77e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
13 changes: 5 additions & 8 deletions neqo-bin/benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,18 @@ fn transfer(c: &mut Criterion) {
neqo_crypto::init_db(PathBuf::from_str("../test-fixture/db").unwrap()).unwrap();

let done_sender = spawn_server();
let mtu = if let Ok(mtu) = env::var("MTU") {
format!("/mtu-{}", mtu)
} else {
"".to_string()
};
let mtu = env::var("MTU").map_or_else(|_| String::new(), |mtu| format!("/mtu-{mtu}"));
for Benchmark { name, requests } in [
Benchmark {
name: format!("1-conn/1-100mb-resp{} (aka. Download)", mtu),
name: format!("1-conn/1-100mb-resp{mtu} (aka. Download)"),
requests: vec![100 * 1024 * 1024],
},
Benchmark {
name: format!("1-conn/10_000-parallel-1b-resp{} (aka. RPS)", mtu),
name: format!("1-conn/10_000-parallel-1b-resp{mtu} (aka. RPS)"),
requests: vec![1; 10_000],
},
Benchmark {
name: format!("1-conn/1-1b-resp{} (aka. HPS)", mtu),
name: format!("1-conn/1-1b-resp{mtu} (aka. HPS)"),
requests: vec![1; 1],
},
] {
Expand All @@ -61,6 +57,7 @@ fn transfer(c: &mut Criterion) {
done_sender.send(()).unwrap();
}

#[allow(clippy::redundant_pub_crate)] // Bug in clippy nursery? Not sure how this lint could fire here.
fn spawn_server() -> tokio::sync::oneshot::Sender<()> {
let (done_sender, mut done_receiver) = tokio::sync::oneshot::channel();
std::thread::spawn(move || {
Expand Down
10 changes: 7 additions & 3 deletions neqo-transport/benches/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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>>) {
fn benchmark_transfer(c: &mut Criterion, label: &str, seed: Option<&impl AsRef<str>>) {
for pacing in [false, true] {
let mut group = c.benchmark_group(format!("transfer/pacing-{pacing}"));
// Don't let criterion calculate throughput, as that's based on wall-clock time, not
Expand Down Expand Up @@ -63,14 +63,18 @@ fn benchmark_transfer(c: &mut Criterion, label: &str, seed: &Option<impl AsRef<s
}

fn benchmark_transfer_variable(c: &mut Criterion) {
benchmark_transfer(c, "varying-seeds", &std::env::var("SIMULATION_SEED").ok());
benchmark_transfer(
c,
"varying-seeds",
std::env::var("SIMULATION_SEED").ok().as_ref(),
);
}

fn benchmark_transfer_fixed(c: &mut Criterion) {
benchmark_transfer(
c,
"same-seed",
&Some("62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
Some(&"62df6933ba1f543cece01db8f27fb2025529b27f93df39e19f006e1db3b8c843"),
);
}

Expand Down

0 comments on commit 76cd77e

Please sign in to comment.