bench/: perf harness + regression-gated PERFORMANCE.md (#398)#433
Merged
Conversation
Performance as an executable, gated fact rather than a README claim. Two metrics, deliberately: - bench/run_bench.sh — wall-clock n=5 medians (the house rule). These feed docs/PERFORMANCE.md and are environment-dependent, so they are PUBLISHED, not gated. - bench/check_regression.sh — the GATE uses cachegrind instruction counts (Ir), which are deterministic: same binary + input => identical Ir on any machine, every run. So it never flakes on runner load. In CI it compares THIS commit's Ir against origin/main, both built in the same runner (`--vs`), so a regression is a pure code-change signal, not machine noise. `--selftest` builds a 2x-work workload and asserts it is flagged, so the gate can't rot into a vacuous pass. Workloads: scalar loop, dict churn, string building, and observed-vs-unobserved — which makes the observer's cost an executable document (~28% wall-clock / ~46% instructions here). New CI `bench` job. The MT spawn/channel cliff stays a documented contract in docs/CONCURRENCY.md; a dedicated MT workload is noted as future work. No runtime/C changes. Closes #398 Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
Performance as an executable, regression-gated fact (Rust's credibility move) rather than a README claim.
Two metrics, on purpose
Wall-clock and instruction count answer different questions, and only one can gate CI honestly:
bench/run_bench.sh— wall-clock n=5 medians (the house rule). Feedsdocs/PERFORMANCE.md; environment-dependent, so published, not gated.bench/check_regression.sh— the gate uses cachegrind instruction counts (Ir), which are deterministic: same binary + input → identicalIron any machine, every run. So it never flakes on runner load. In CI it compares this commit'sIragainst origin/main, both built in the same runner (--vs) — a regression is a pure code-change signal, not machine noise. No cross-environment baseline drift.Not vacuous:
--selftestbuilds a 2×-work workload and asserts it's flagged (measured +105% Ir > 5% threshold).The observer cost, now an executable document
observed_loopvsunobserved_loopis the same arithmetic; the difference is per-assignment observer bookkeeping — measured here at ~28% wall-clock / ~46% instructions. Sounobserved:on a hot numeric loop is a real, now-gated win.Acceptance
bash bench/run_bench.shreproduces medians locally ✓--selftest, deterministic + in-env)benchjob; no runtime/C changes.The MT spawn/channel cliff stays a documented contract in docs/CONCURRENCY.md; a dedicated MT workload is noted as future work.
Closes #398
🤖 Generated with Claude Code