bench: add counterbalanced performance regression runner - #243
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
LeanToken's benchmark examples measure one revision at a time, but they do not produce a same-host base/head regression decision. This adds an opt-in runner that:
The orchestration borrows the clean-worktree and counterbalanced-run pattern from justrach/codedb#675, but delegates medians, confidence intervals, and significance testing to pinned Benchstat rather than implementing statistics locally. Collection is paired to reduce order bias; Benchstat's comparison remains its independent-sample Mann-Whitney test.
The branch also initializes
continuation_cursorin the Windows-only junction-containment fixture. That initializer was missed when the field became required onmain, so the Windows test target otherwise failed to compile.Decision rule
Thresholds live in
benchmarks/paired_performance.jsonand are set per operation. A row fails only when the head median exceeds both its relative and absolute regression thresholds and Benchstat reports a significant change.NOISE: relative threshold exceeded, absolute threshold not exceededINCONCLUSIVE: both materiality thresholds exceeded, significance not establishedFAIL: both materiality thresholds exceeded and significance establishedhot_path_boundshashes the complete final response for each timed operation after timing. The runner uses one fixed disposable repository path across samples so repository identity is stable and the hashes are directly comparable. Indexing parity covers the frozen corpus and observable operation counts.Testing
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-features --lib --bins --test integrationcargo test-extrascargo test --all-features --docPYTHONDONTWRITEBYTECODE=1 python3 -m unittest scripts/test_paired_performance.pygit diff --checkhot_path_boundsexecutions produced identical observable-response hashesThe reduced-corpus smoke validates orchestration only; it is not performance evidence for LeanToken.
Impact
The CLI change is an additive
--repository-rootoption on the benchmark example, used to keep response identity stable across processes. Product CLI behavior is unchanged.Suggested review order
benchmarks/paired_performance.jsonandbenchmarks/run_paired_performance.shscripts/paired_performance.pyand its behavior testsexamples/hot_path_bounds.rs