diff --git a/benches/hot_path.rs b/benches/hot_path.rs index ecd84ae..accfcf2 100644 --- a/benches/hot_path.rs +++ b/benches/hot_path.rs @@ -3,14 +3,13 @@ use std::net::Ipv4Addr; use numa::buffer::BytePacketBuffer; use numa::cache::DnsCache; -use numa::header::{DnsHeader, ResultCode}; +use numa::header::ResultCode; use numa::packet::DnsPacket; use numa::question::{DnsQuestion, QueryType}; use numa::record::DnsRecord; fn make_response(domain: &str) -> DnsPacket { let mut pkt = DnsPacket::new(); - pkt.header = DnsHeader::new(); pkt.header.id = 0x1234; pkt.header.response = true; pkt.header.recursion_desired = true; @@ -93,7 +92,7 @@ fn bench_cache_lookup_hit(c: &mut Criterion) { } fn bench_cache_lookup_miss(c: &mut Criterion) { - let mut cache = DnsCache::new(10_000, 60, 86400); + let cache = DnsCache::new(10_000, 60, 86400); c.bench_function("cache_lookup_miss", |b| { b.iter(|| cache.lookup(black_box("nonexistent.com"), QueryType::A)) diff --git a/benches/throughput.rs b/benches/throughput.rs index 688b4e0..e01a25c 100644 --- a/benches/throughput.rs +++ b/benches/throughput.rs @@ -37,7 +37,7 @@ fn make_response(domain: &str) -> DnsPacket { /// Simulates the complete cached query pipeline (sans network I/O): /// parse → cache lookup → TTL adjust → serialize response -fn simulate_cached_pipeline(query_wire: &[u8], cache: &mut numa::cache::DnsCache) -> usize { +fn simulate_cached_pipeline(query_wire: &[u8], cache: &numa::cache::DnsCache) -> usize { let mut buf = BytePacketBuffer::from_bytes(query_wire); let query = DnsPacket::from_buffer(&mut buf).unwrap(); let q = &query.questions[0]; @@ -71,7 +71,7 @@ fn bench_pipeline_throughput(c: &mut Criterion) { b.iter(|| { for _ in 0..count { let wire = &query_wires[idx % query_wires.len()]; - simulate_cached_pipeline(wire, &mut cache); + simulate_cached_pipeline(wire, &cache); idx += 1; } });