Feat/benchmark#84
Merged
Merged
Conversation
Add benchmarking infrastructure to measure performance of identified hot paths in the packet processing pipeline. Benchmarks use rdtsc for cycle-accurate timing and avoid ASAN to get accurate measurements. Benchmarks included: - bench-decode: Header parsing overhead (decode vs re-parse) - bench-malloc: Per-packet allocation cost (malloc vs ring buffer) - bench-rotation: Interval table rotation (copy vs swap) - bench-sort: Flow sorting (full sort vs partial top-N) Initial results show significant optimization opportunities: - Ring buffer: 72% fewer cycles than malloc/free - Partial sort: 86% fewer cycles than HASH_SRT - Swap rotation: 37% fewer cycles than copy Run with: make -C deps/toptalk bench 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add bench_regression.c with automated performance threshold checks for critical operations: - Header decoding: <500 cycles - Ring buffer allocation: <100 cycles - Top-N flow selection: <5000 cycles (100 flows) Run with: make -C deps/toptalk bench-test This ensures performance improvements are not regressed by future changes. Thresholds are set conservatively high to avoid false failures on varying hardware. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Test 4 to bench_regression.c measuring the actual per-packet hot path through update_stats_tables(). Tests two scenarios: - Single flow: ~57 cycles/op (hash hit case) - 10K flows: ~200 cycles/op (hash table stress) Adds benchmark hooks to intervals.h/c: - tt_bench_init(): Initialize data structures without pcap - tt_bench_cleanup(): Clean up after benchmarking - tt_bench_update_stats(): Process decoded packet through stats path Results show the optimizations achieved the 200 cycle/packet target, enabling ~15M pps theoretical throughput on a 3 GHz CPU. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.