feat: CPU overhead benchmark + autoresearch loop - #32
Open
samcm wants to merge 328 commits into
Open
Conversation
samcm
force-pushed
the
daring-bee-524
branch
2 times, most recently
from
April 1, 2026 00:42
7e677d2 to
2a564a2
Compare
autoresearch iteration 114: Remove direction from aggregation key since TX/RX already use separate maps. Eliminates redundant pack/unpack.
autoresearch iteration 115: Only write min/max fields when the new sample actually updates the extrema. Reduces memory stores per event.
autoresearch iteration 116: stress-bench doesn't use epoll_wait. Moving it to cold path shrinks the hot per-PID aggregate.
autoresearch iteration 117: Force inlining on tiny hot-path aggregate methods to reduce call overhead. Local microbench shows ~18% faster.
autoresearch iteration 118: Parser outputs local_port/remote_port directly. Sink no longer branches on direction to swap src/dst.
autoresearch iteration 119: Same approach as TX/RX split. Disk reads and writes no longer evict each other from FastMap last-hit cache.
autoresearch iteration 120: Running threads are few and small (~32B). SmallVec<[_;8]> avoids heap allocation for typical core counts.
autoresearch iteration 121: Direct call to process_event_inner from batch path. Removes one function call per event.
autoresearch iteration 122: Scheduler on_cpu/sched_wait latency no longer inflates the hot basic_metrics entry. Syscall/FD/page-fault paths hit a smaller aggregate.
autoresearch iteration 123: Each syscall type gets its own LatencyAggregate map instead of sharing one large mixed aggregate. Smaller values = better cache utilization per event.
autoresearch iteration 124: FD open/close and page faults no longer share an aggregate. Each gets its own tiny map with last-hit cache.
autoresearch iteration 125: sched_switch and sched_runqueue no longer share one map. Each gets its own small-value map with last-hit cache. Removed unused BasicSchedulerAggregate. -47 lines.
autoresearch iteration 126: UDP send no longer carries unused TCP fields (srtt_us, snd_cwnd) through the BPF hash map.
autoresearch iteration 127: sched_switch resolves running thread by cpu_id array index (O(1)) instead of TID cache + linear scan. Removes RunningThreadStore, TID cache, SmallVec. -76 lines.
autoresearch iteration 128: Repeated scheduler lookups for the same TID skip the CPU slot scan via a small validated cache.
autoresearch iteration 129: After initial unaligned copy, field reads should use aligned access. One-line repr change with size assertion.
autoresearch iteration 130: The every-1000-events stats callback only wrote a constant zero gauge. Remove it from the hot loop. -15 lines.
autoresearch iteration 131: Combined scheduler events update both aggregates in one pass instead of routing through separate handlers.
autoresearch iteration 132: Each CPU core gets its own FastMap for cpu_on_core accounting. Scheduler events from different cores no longer evict each other's last-hit cache. Smaller key (u64 vs u128).
autoresearch iteration 133: Avoid temporary CpuCoreDimension pack/unpack when writing to per-core maps.
autoresearch iteration 134: Replace O(active_cpus) scan with direct HashMap lookup for sched_runqueue/combined/process_exit paths.
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.
Summary
stress-bench.c) generates deterministic syscall load across 4 threads/proc/<pid>/stat(unaffected by noisy CI neighbors)bench-cpulabel orworkflow_dispatchautoresearch/program.mdprovides context for codex-driven optimization loopNew files
bench-cpu/— benchmark infrastructure (stress workload, mock beacon, runner, comparator).github/workflows/cpu-bench.yaml— CI workflowautoresearch/program.md— research brief for autonomous optimization