feat: self-host fonts, styled block page, wildcard TLS #16

Merged
razvandimescu merged 4 commits from perf/hot-path-optimizations into main 2026-03-27 08:19:54 +08:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit f8e340ca17 - Show all commits

View File

@@ -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))

View File

@@ -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;
}
});