From 9f7a15599f2d4fe90e4135f0be8940ef38bb1257 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:23:11 +0200 Subject: [PATCH] long variable names Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- benches/ipc.rs | 18 +++++++++--------- benches/ipc_receiver_set.rs | 18 +++++++++--------- benches/platform.rs | 14 +++++++------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/benches/ipc.rs b/benches/ipc.rs index f84afd93..c481e993 100644 --- a/benches/ipc.rs +++ b/benches/ipc.rs @@ -12,10 +12,10 @@ use ipc_channel::ipc; /// as the benchmark framework doesn't know about the inner iterations... const ITERATIONS: usize = 1; -fn transfer_empty(c: &mut Criterion) { - c.bench_function("transfer_empty", |b| { +fn transfer_empty(criterion: &mut Criterion) { + criterion.bench_function("transfer_empty", |bencher| { let (tx, rx) = ipc::channel().unwrap(); - b.iter(|| { + bencher.iter(|| { for _ in 0..ITERATIONS { tx.send(()).unwrap(); rx.recv().unwrap() @@ -24,15 +24,15 @@ fn transfer_empty(c: &mut Criterion) { }); } -fn transfer_senders(c: &mut Criterion) { - c.bench_function(&format!("transfer_senders_{COUNT:02}"), |b| { +fn transfer_senders(criterion: &mut Criterion) { + criterion.bench_function(&format!("transfer_senders_{COUNT:02}"), |bencher| { let (main_tx, main_rx) = ipc::channel().unwrap(); let transfer_txs: Vec<_> = (0..COUNT) .map(|_| ipc::channel::<()>().unwrap()) .map(|(tx, _)| tx) .collect(); let mut transfer_txs = Some(transfer_txs); - b.iter(|| { + bencher.iter(|| { for _ in 0..ITERATIONS { main_tx.send(transfer_txs.take().unwrap()).unwrap(); transfer_txs = Some(main_rx.recv().unwrap()); @@ -41,15 +41,15 @@ fn transfer_senders(c: &mut Criterion) { }); } -fn transfer_receivers(c: &mut Criterion) { - c.bench_function(&format!("transfer_receivers_{COUNT:02}"), |b| { +fn transfer_receivers(criterion: &mut Criterion) { + criterion.bench_function(&format!("transfer_receivers_{COUNT:02}"), |bencher| { let (main_tx, main_rx) = ipc::channel().unwrap(); let transfer_rxs: Vec<_> = (0..COUNT) .map(|_| ipc::channel::<()>().unwrap()) .map(|(_, rx)| rx) .collect(); let mut transfer_rxs = Some(transfer_rxs); - b.iter(|| { + bencher.iter(|| { for _ in 0..ITERATIONS { main_tx.send(transfer_rxs.take().unwrap()).unwrap(); transfer_rxs = Some(main_rx.recv().unwrap()); diff --git a/benches/ipc_receiver_set.rs b/benches/ipc_receiver_set.rs index 05697f34..5bbd9357 100644 --- a/benches/ipc_receiver_set.rs +++ b/benches/ipc_receiver_set.rs @@ -15,8 +15,8 @@ use ipc_channel::ipc::{self, IpcReceiverSet}; /// Benchmark selecting over a set of `n` receivers, /// with `to_send` of them actually having pending data. -fn bench_send_on_m_of_n(c: &mut Criterion) { - c.bench_function(&format!("bench_send_on_{TO_SEND}_of_{N}"), |b| { +fn bench_send_on_m_of_n(criterion: &mut Criterion) { + criterion.bench_function(&format!("bench_send_on_{TO_SEND}_of_{N}"), |bencher| { let mut senders = Vec::with_capacity(N); let mut rx_set = IpcReceiverSet::new().unwrap(); for _ in 0..N { @@ -24,7 +24,7 @@ fn bench_send_on_m_of_n(c: &mut Criterion) rx_set.add(rx).unwrap(); senders.push(tx); } - b.iter(|| { + bencher.iter(|| { for _ in 0..ITERATIONS { for tx in senders.iter().take(TO_SEND) { tx.send(()).unwrap(); @@ -47,9 +47,9 @@ fn create_set_of_n() -> IpcReceiverSet { rx_set } -fn create_and_destroy_set_of_n(c: &mut Criterion) { - c.bench_function(&format!("create_and_destroy_set_of_{N}"), |b| { - b.iter(|| { +fn create_and_destroy_set_of_n(criterion: &mut Criterion) { + criterion.bench_function(&format!("create_and_destroy_set_of_{N}"), |bencher| { + bencher.iter(|| { for _ in 0..ITERATIONS { create_set_of_n::(); } @@ -60,9 +60,9 @@ fn create_and_destroy_set_of_n(c: &mut Criterion) { // Benchmark performance of removing closed receivers from set. // This also includes the time for adding receivers, // as there is no way to measure the removing in isolation. -fn add_and_remove_n_closed_receivers(c: &mut Criterion) { - c.bench_function(&format!("add_and_remove_{N}_closed_receivers"), |b| { - b.iter(|| { +fn add_and_remove_n_closed_receivers(criterion: &mut Criterion) { + criterion.bench_function(&format!("add_and_remove_{N}_closed_receivers"), |bencher| { + bencher.iter(|| { for _ in 0..ITERATIONS { // We could keep adding/removing senders to the same set, // instead of creating a new one in each iteration. diff --git a/benches/platform.rs b/benches/platform.rs index 6f7ed529..29ed98ba 100644 --- a/benches/platform.rs +++ b/benches/platform.rs @@ -13,9 +13,9 @@ use std::sync::{mpsc, Mutex}; /// as the benchmark framework doesn't know about the inner iterations... const ITERATIONS: usize = 1; -fn create_channel(c: &mut Criterion) { - c.bench_function("create_channel", |b| { - b.iter(|| { +fn create_channel(criterion: &mut Criterion) { + criterion.bench_function("create_channel", |bencher| { + bencher.iter(|| { for _ in 0..ITERATIONS { platform::channel().unwrap(); } @@ -23,8 +23,8 @@ fn create_channel(c: &mut Criterion) { }); } -fn transfer_data(c: &mut Criterion) { - c.bench_function(&format!("transfer_data_{SIZE}"), |b| { +fn transfer_data(criterion: &mut Criterion) { + criterion.bench_function(&format!("transfer_data_{SIZE}"), |bencher| { let data: Vec = (0..SIZE).map(|i| (i % 251) as u8).collect(); let (tx, rx) = platform::channel().unwrap(); @@ -32,7 +32,7 @@ fn transfer_data(c: &mut Criterion) { let wait_rx = Mutex::new(wait_rx); if SIZE > platform::OsIpcSender::get_max_fragment_size() { - b.iter(|| { + bencher.iter(|| { crossbeam_utils::thread::scope(|scope| { let tx = tx.clone(); scope.spawn(|_| { @@ -63,7 +63,7 @@ fn transfer_data(c: &mut Criterion) { }) }); } else { - b.iter(|| { + bencher.iter(|| { for _ in 0..ITERATIONS { tx.send(&data, vec![], vec![]).unwrap(); rx.recv().unwrap();