fix(benchmark): any win is green — yellow is for losing only - #319
Conversation
`deltaTone` required a 5% margin before painting the candidate green, so a real-but-modest win (say -3% on LCP, or a step 30ms faster) rendered in the same yellow as a tie or a small regression. In a client-facing report that reads as "no better", which is the wrong story for a win. Now: candidate faster at all -> green. Slower by >5% -> red. Yellow means a tie or a loss too small to call meaningful. The 5% dead band stays on the losing side, where it belongs — a 2% regression really is noise. All four call sites (step deltas, stat tiles, Lighthouse vitals cells, bars) route through `deltaTone`, so navigation timings and Web Vitals both pick it up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Verdict: COMMENT — the asymmetry is defensible and no higher-is-better metric goes through Worth fixing
Correction to the PR bodyBars do not route through Checked, fineAll five metrics reaching Could not execute the two new cases ( |
Follow-up on the review of #319. `pctChange` rounds with `toFixed(0)`, so the exact band this PR newly greens — a win under 0.5% — printed as a win-green `-0%`: a cell whose colour and digits contradict each other. Sub-1% deltas now carry one decimal (`-0.3%`), on both the stat tiles and the step-delta header. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks — acted on the one finding this diff actually caused, left the rest alone. Fixed (1df3349): the Correction accepted: the bars don't route through Not fixed here, all pre-existing and independent of this diff:
Those three are one coherent follow-up — teaching the tile grid and the hero the failure/direction guards The asymmetric band is deliberate, not an oversight: green on any win is the requested behaviour, and the 5% dead band stays on the losing side because a 2% regression really is run-to-run noise. |
Problem
deltaTonein the benchmark HTML report needed a 5% margin before it wouldpaint the candidate green:
So a real win of, say, 3% on LCP — or a step 30ms faster — came out the same
yellow as a tie or a small regression. In a client-facing report that reads
as "no better", which is the wrong story to tell about a win.
Fix
Yellow now only ever means tie-or-losing. The 5% dead band stays on the
losing side, where it belongs — a 2% regression really is run-to-run noise,
and reddening it would be the same false-signal bug mirrored.
All four call sites route through
deltaTone— per-step deltas, the stat tiles,the Lighthouse vitals cells and the bars — so navigation timings and Web Vitals
both pick this up with no further changes.
Test
Two cases added to
tests/engine/benchmark-stats.test.tspinning the newcontract (a 0.1% win is green; a 2% loss is yellow, not red). 14 pass.
🤖 Generated with Claude Code
Summary by cubic
Any faster candidate now renders green in the benchmark HTML report; yellow is only for ties or small losses. Previously green needed a 5% win; red still starts at >5% slower, and sub‑1% deltas now show one decimal to avoid "-0%" on green cells.
deltaTone(step deltas, stat tiles, Lighthouse vitals, bars) inherit this behavior.Written for commit 1df3349. Summary will update on new commits.