summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/benches/range_tracker.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/rust/neqo-transport/benches/range_tracker.rs16
1 files changed, 9 insertions, 7 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,
- )
+ );
},
);
}