fix(bench): stabilize peer solver timing - #73
Conversation
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the npm run bench -- --gate performance gate by measuring the synchronous, CPU-bound peer-solver benchmark using process CPU time instead of wall-clock time, preventing hosted-runner scheduling pauses from causing false regressions.
Changes:
- Update the peer-solver benchmark to use
process.cpuUsage()deltas (user + system) for sample timing. - Preserve the existing warmup behavior, 50 ms budget, sampling count, and p95 calculation semantics.
- Document the benchmark measurement correction in the pending
0.0.20changelog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| CHANGELOG.md | Documents the benchmark timing correction in the upcoming release notes. |
| benchmarks/cli.mjs | Switches the peer-solver benchmark measurement from wall-clock time to process CPU time while keeping the same gating thresholds and statistics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f48e6f0 to
8fde544
Compare
8fde544 to
ca41848
Compare
Reviewed ca41848 — the batched wall-clock approach is correct.
No issues found. |
Summary
Reproduction
The unchanged solver completed in 12–18 ms locally, but the ten-sample p95 selected the single maximum sample. Isolated hosted-runner scheduling/GC pauses therefore produced false wall-clock failures at 50.5 ms and 51.7 ms. An attempted process-CPU measurement was also rejected by CI after parallel V8/GC work inflated one sample to 75.7 ms.
The final measurement averages five solves per sample, preserving wall-clock throughput and the 50 ms per-solve budget while preventing one unrelated pause from masquerading as a regression.
Verification
npm ci/npm audit(0 vulnerabilities)npm run fmt -- --checknpm run lintnpm run check(224 tests with coverage)npm run test:templates(full-stack, SPA, SSR, SSG, StartKit)node --import tsx benchmarks/cli.mjs --gaterepetitionsThe final batched per-solve measurements were 12.2–13.8 ms; no budget was loosened.