Skip to content

Commit e7b6ca2

Browse files
committed
Make old et conditional for test or bench
1 parent c8d73c1 commit e7b6ca2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

quinn-proto/benches/send_buffer.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@ use iroh_quinn_proto::bench_exports::send_buffer::*;
44
// Since we can't easily access test utilities, this is a minimal benchmark
55
// that measures the actual problematic operations directly
66

7-
benchmark_group!(
8-
benches,
9-
get_into_many_segments,
10-
get_loop_many_segments,
11-
);
7+
benchmark_group!(benches, get_into_many_segments, get_loop_many_segments,);
128
benchmark_main!(benches);

quinn-proto/src/connection/send_buffer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ impl SendBufferData {
9393
/// Returns data which is associated with a range
9494
///
9595
/// Requesting a range outside of the buffered data will panic.
96+
#[cfg(any(test, feature = "bench"))]
9697
fn get(&self, offsets: Range<u64>) -> &[u8] {
9798
assert!(
9899
offsets.start >= self.range().start && offsets.end <= self.range().end,
@@ -244,6 +245,7 @@ impl SendBuffer {
244245
/// in noncontiguous fashion in the send buffer. In this case callers
245246
/// should call the function again with an incremented start offset to
246247
/// retrieve more data.
248+
#[cfg(any(test, feature = "bench"))]
247249
pub(super) fn get(&self, offsets: Range<u64>) -> &[u8] {
248250
self.data.get(offsets)
249251
}
@@ -504,7 +506,7 @@ mod tests {
504506
#[cfg(feature = "bench")]
505507
pub mod send_buffer {
506508
//! Bench fns for SendBuffer
507-
//!
509+
//!
508510
//! These are defined here and re-exported via `bench_exports` in lib.rs,
509511
//! so we can access the private `SendBuffer` struct.
510512
use bencher::Bencher;
@@ -529,7 +531,7 @@ pub mod send_buffer {
529531
bench.iter(|| {
530532
// Get from end (very slow - scans through all 1000 segments)
531533
tgt.clear();
532-
buf.get_into( BYTES - PACKET_SIZE..BYTES, bencher::black_box(&mut tgt));
534+
buf.get_into(BYTES - PACKET_SIZE..BYTES, bencher::black_box(&mut tgt));
533535
});
534536
}
535537

0 commit comments

Comments
 (0)