* perf: optimize hot path — RwLock, inline filtering, pre-allocated strings - Mutex → RwLock for cache, blocklist, and overrides (concurrent read access) - Make cache.lookup() and overrides.lookup() take &self (read-only) - Eliminate 3 Vec allocations per DnsPacket::write() via inline filtering - Pre-allocate domain strings with capacity 64 in parse path - Add criterion micro-benchmarks (hot_path + throughput) - Add bench README documenting both benchmark suites Measured improvement: ~14% faster parsing, ~9% pipeline throughput, round-trip cached 733ns → 698ns (~2.3M queries/sec). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: simplify benchmark code after review - Remove redundant DnsHeader::new() (already set by DnsPacket::new()) - Remove unused DnsHeader import - Change simulate_cached_pipeline to take &DnsCache (lookup is &self now) - Remove unnecessary mut on cache in cache_lookup_miss bench Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
47 lines
977 B
Makefile
47 lines
977 B
Makefile
.PHONY: all build lint fmt check audit test bench clean deploy blog
|
|
|
|
all: lint build
|
|
|
|
build:
|
|
cargo build
|
|
|
|
lint: fmt check audit
|
|
|
|
fmt:
|
|
cargo fmt --check
|
|
|
|
check:
|
|
cargo clippy -- -D warnings
|
|
|
|
audit:
|
|
cargo audit
|
|
|
|
test:
|
|
cargo test
|
|
|
|
bench:
|
|
cargo bench
|
|
|
|
blog:
|
|
@mkdir -p site/blog
|
|
@for f in blog/*.md; do \
|
|
name=$$(basename "$$f" .md); \
|
|
pandoc "$$f" --template=site/blog-template.html -o "site/blog/$$name.html"; \
|
|
echo " $$f → site/blog/$$name.html"; \
|
|
done
|
|
|
|
clean:
|
|
cargo clean
|
|
|
|
deploy:
|
|
cargo build --release
|
|
sudo cp target/release/numa /usr/local/bin/numa
|
|
ifeq ($(shell uname -s),Darwin)
|
|
sudo codesign -f -s - /usr/local/bin/numa
|
|
sudo kill $$(pgrep -f /usr/local/bin/numa) 2>/dev/null || true
|
|
else
|
|
sudo systemctl restart numa 2>/dev/null || sudo kill $$(pgrep -f /usr/local/bin/numa) 2>/dev/null || true
|
|
endif
|
|
@sleep 1
|
|
@dig @127.0.0.1 google.com +short +time=3 > /dev/null && echo "Service restarted successfully" || echo "Warning: DNS not responding yet"
|