feat(cli): make benchmark reports comparable across runs and machines - #596
feat(cli): make benchmark reports comparable across runs and machines#596pablodeymo wants to merge 1 commit into
Conversation
🤖 Kimi Code Review
General
Security/Memory: No unsafe code introduced. File I/O in build.rs is limited to reading the lockfile; paths are constructed from Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code ReviewFindings
No consensus-path, fork-choice, attestation-validation, SSZ, or XMSS-processing logic is touched here, so I did not find consensus/security regressions in the Ethereum client code itself. I could not run the Rust tests in this sandbox because Cargo/rustup attempted to write under read-only Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewReview: PR 596 — benchmark report comparability (stats, provenance, JSON)This is benchmarking-tool code, not consensus-critical logic, so the risk profile is low, but there's one finding that materially affects CI cost/time and directly contradicts the PR's own claims. 1. CI smoke step does not reuse the previous build, contrary to its comment (
|
233cc94 to
428174e
Compare
605531f to
254cf06
Compare
428174e to
db70dbf
Compare
254cf06 to
9226605
Compare
db70dbf to
99adf46
Compare
9226605 to
e1bea8a
Compare
Per-iteration rows show what one build cost; comparing an optimization against a baseline needs three more things, which this adds. Aggregate statistics per phase — count, min, mean, p50, p90, max, and a coefficient of variation flagged above 10% so a noisy run is not read as a result. Percentiles are nearest-rank, without interpolation: sample counts are small, so an exact observed value beats a blend of two. Outliers are never discarded, and the raw per-iteration rows stay above the summary. Build provenance — build.rs resolves the leansig and leanVM revisions from Cargo.lock into the report. leansig is pinned to a moving branch and leanVM does the signature aggregation, so either one moves the measured crypto; two reports that disagree on them are not comparable, and without this the report cannot say so. The per-[[package]] parse collects `name` and `source` before extracting the rev, so it does not depend on TOML field order. Machine-readable output — `--format json` with a schema_version, and `--output <path>` to write it alongside a human-readable run. Logs already go to stderr, so the JSON pipes straight into jq. CI gains a seconds-fast mock smoke step that asserts the contract, so a change to the report shape cannot land unnoticed.
99adf46 to
c2da08d
Compare
e1bea8a to
9df5f5f
Compare
🗒️ Description / Motivation
Per-iteration rows show what one build cost. Comparing an optimization against a baseline
needs three more things, and this adds them: aggregate statistics, build provenance, and
machine-readable output.
Third of three (design doc → harness → this).
What Changed
bin/ethlambda/src/benchmark/report.rsStats/Summaryplusstats(),percentile()and the aggregate table: count, min, mean, p50, p90, max per phase, and a CV flagged above 10%.schema_version+to_json().Environmentgains the two resolved crypto revisionsbin/ethlambda/build.rsCargo.lockintorustc-envvars. The per-[[package]]parse collectsnameandsourcebefore extracting the rev, so it does not depend on TOML field orderbin/ethlambda/src/benchmark/mod.rs--format human|jsonand--output <path>bin/ethlambda/Cargo.toml,Cargo.lockserde_json.github/workflows/ci.ymlCorrectness / Behavior Guarantees
observed value beats a blend of two neighbours.
so a heavy tail stays visible instead of being averaged away. A CV above 10% is flagged
so a noisy run is not read as a result.
branch and leanVM does the signature aggregation, so either revision moving moves the
measured crypto. Two reports that disagree on them are not comparable, and without this
the report cannot say so.
unnoticed. Logs already go to stderr, so the JSON pipes straight into
jq.build.rsonly adds env vars consumed by the report.Tests Added / Run
report.rs: percentile on a single sample and on odd/even lengths;stats()against aknown set whose population stddev gives CV = 0.4;
stats()on empty input is zeroed.jq -e '.schema_version == 1 and (.samples | length == 3)'passes, and reports carryboth resolved revisions.
make fmt,make lint,make test(580 tests, 30 suites) — all clean.Related Issues / PRs
✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(cargo test --workspace --profile release-fast) — all passing