Skip to content

perf(ci): add low-mutation skip-floor column to /perf - #697

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 4 commits into
mainfrom
azchohfi-perf-skipfloor
Jun 26, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 4 commits into
mainfrom
azchohfi-perf-skipfloor

Conversation

@azchohfi

@azchohfi Alexandre Zollinger Chohfi (azchohfi) commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

What

Adds a low-mutation skip-floor column to the /perf comparison: a second interleaved A/B macro leg run at --percent 0, rendered as its own table directly after the 50%-mutation headline regression table.

This is PR3 of the harness-improvement split (PR1 #691 alloc metric + paired-CI, PR2 #693 micro-suite — both merged). Measurement-tooling only: 7 files, all measurement-tooling (incl. .github/workflows/perf-compare.yml), 0 src/Reactor.

Why

The headline leg runs at --percent 50 (half the cells mutate per tick). At that rate the per-tick cost is dominated by the changed cells, and a large fixed cost is diluted: ChildReconciler re-walks all children every tick to find what moved — an O(n) pass that runs whether 1 cell changed or 500 did. At 50% that skip-walk is a fraction of the work, so a structural-skip optimization (skip untouched child ranges) barely moves the headline number.

At --percent 0 the workload still mutates exactly one cell per tick (StockDataSource.Update clamps the change count to Math.Max(1, …)), so virtually every child is unchanged and reconcile/diff time is the skip-walk floor. That makes the floor the whole signal instead of a diluted fraction — which is what lets a structural-skip PR's win clear a paired-Δ 95% CI.

This is the column the in-flight reconciler structural-skip work needs to be measured cleanly: at 50% mutation its win is buried; at 0% it is isolated.

Methodology rationale (carried from the n=12 validation)

The earlier validation (12 interleaved PR-vs-main pairs on this workload) established the band these harness PRs are built on:

  • A 2-run median is a coin flip for ~1–3% deltas — the headline rps reproduced its sign only ~23% of the time, and the run-to-run swing (±7–11%) dwarfs the effect.
  • The old blanket 4% floor preordained every sub-4% verdict as "noise," both burying real wins and rubber-stamping noise.
  • Macro reconcile/diff at 50% mutation is render-/dilution-bound — the very signal a structural-skip optimization moves is the part the headline workload dilutes.

The skip-floor leg attacks that last point directly: same interleaving, reps (12), warm-up (2), GC/affinity pinning, and paired-Δ 95%-CI gating as the headline leg (a change is flagged only when the CI excludes 0), but at a mutation rate where the O(n) floor is the dominant term.

Changes

  • Run-PerfBenchmark.ps1 — -IncludeSkipFloor (default $true) + -SkipFloorPercent (default 0); Invoke-OneRun gains -RunPercent (defaults to $Percent); a second interleaved A/B loop tagged main-floor/pr-floor; floor aggregates threaded into $ctx + result.json.
  • PerfLib.ps1 — new Format-PerfSkipFloorSection (mirrors Table 1, reuses $PerfMetricSpec + the paired-CI Get-PerfDelta; empty when either floor aggregate is null); Format-PerfComment gains -MainFloor/-PrFloor and renders the section after the regression table.
  • Tests — PerfLib.Tests.ps1 (+11 assertions → 203): section renders/omits, ordering between the regression and cross-framework tables, and a mixed-direction fixture proving per-metric direction-awareness (rps and reconcile both fall, but rps reads regression / reconcile reads improvement). RunPerfBenchmark.Tests.ps1 (+2 → 27): locks that the floor leg actually drives the harness at --percent 0 (and that omitting -RunPercent falls back to $Percent).
  • Docs — ci/README.md (params + comment section) and METHODOLOGY.md (new skip-floor subsection).

No harness/src change — the floor leg just drives the existing exe at a different mutation percent.

Validation

  • PerfLib.Tests.ps1 202 green · RunPerfBenchmark.Tests.ps1 27 green.
  • End-to-end smoke with a stub harness (emits a metrics.json whose reconcile/diff scale with --percent): the real orchestrator ran both interleaved legs and rendered the skip-floor table in the designed position with sane numbers (floor reconcile ~8 ms vs 50% headline ~76 ms). -IncludeSkipFloor $false correctly omits the leg and the table.

Cost

The floor leg roughly doubles the macro-leg runtime (a second Warmup + Reps interleaved A/B). It is opt-out via -IncludeSkipFloor $false. The workflow leaves it on by default so /perf on a fleet PR picks it up automatically.

Review

Ran the internal pr-review skill (8 dimensions + a cross-family multi-model check). It surfaced 0 critical / 0 high; all actionable findings are addressed:

  • Paired-CI alignment (correctness): a one-sided run failure could misalign the index-paired CI. Both macro legs (headline + skip-floor) now drop both halves of a pair on any one-sided failure — a no-op on the happy path, but it keeps Get-PerfPairedDeltaStats (which zips main[i] vs pr[i]) from ever comparing mismatched indices.
  • Direction-awareness test (coverage): added a mixed-direction fixture so the renderer's per-metric higher/lower-is-better logic is locked, not just "some row says improvement."
  • Docs/help: added .PARAMETER help for the two new params; reworded the floor preamble to "headline table" (accurate for any -Percent); refreshed the stale perf-compare.yml header + ci/README table list.

Declined with rationale: the Format-PerfComment optional-before-mandatory param order (consistent with the pre-existing -WinUI3/-Rust/-Micro convention; all callers use named binding) and a full orchestration-flow unit test (the main script body isn't dot-sourceable — same reason the pre-existing headline leg isn't unit-tested at that layer; covered by an end-to-end smoke).

Discipline

DRAFT until the 5-point harness gate holds (footprint = tooling-only ✓, CI green, Copilot 0-unresolved on final HEAD, pr-review skill + findings addressed, PerfLib.Tests green + local smoke ✓). No /perf run needed — this changes /perf itself.

Add a second interleaved A/B macro leg at `--percent 0` to the /perf comparison,
rendered as its own "Low-mutation skip-floor" table after the 50%-mutation
headline table.

Why: at 50% mutation the per-tick cost is dominated by the changed cells, so the
O(n) positional child skip-walk (ChildReconciler re-walks every child each tick
even when nothing moved) is diluted to a fraction of the work. A structural-skip
optimization that skips untouched child ranges barely moves the 50% headline
number. At `--percent 0` the workload still mutates exactly one cell/tick
(StockDataSource.Update clamps the change count to Math.Max(1, ...)), so
reconcile/diff isolate that skip-walk floor — it becomes the whole signal, which
is what lets such a win clear a paired-delta 95% CI.

The floor leg reuses the same interleaving, reps, warmup, GC/affinity pinning,
and 95%-CI gating as the headline leg (each leg's delta independently cancels
time-correlated drift). Opt-out via -IncludeSkipFloor $false; percent via
-SkipFloorPercent. No harness/src change — it just drives the existing exe at a
different mutation percent.

Tooling-only (tests/stress_perf/**); 0 src/Reactor. PerfLib.Tests 202 /
RunPerfBenchmark.Tests 27 green; validated end-to-end against a stub harness
(both -IncludeSkipFloor on and off render/omit the table correctly).

Co-authored-by: Copilot <[email protected]>
- Keep the paired A/B macro legs (headline + skip-floor) index-aligned: a
  one-sided run failure now drops BOTH halves of the pair instead of shifting
  later samples, so Get-PerfPairedDeltaStats (which zips main[i] vs pr[i]) can
  never compare mismatched run indices. No-op on the happy path.
- Add .PARAMETER help for -IncludeSkipFloor / -SkipFloorPercent.
- Reword the skip-floor preamble "50%-mutation table" -> "headline table" so it
  stays accurate when -Percent is customized.
- Harden the renderer test with a mixed-direction fixture: rps and reconcile both
  decrease, but rps (higher-better) must read regression while reconcile
  (lower-better) reads improvement — locking per-metric direction-awareness.
- Refresh stale comment-structure docs (perf-compare.yml header, ci/README "Two
  tables") to reflect the added tables.

Tooling-only; 0 src/Reactor. PerfLib.Tests 203 / RunPerfBenchmark.Tests 27 green.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the /perf CI comparison comment by adding a second interleaved macro leg at near-zero mutation (--percent 0 by default) and rendering its results as a dedicated “low-mutation skip-floor” table immediately after the existing 50%-mutation headline table. This strengthens the harness’ ability to detect improvements that primarily reduce fixed per-tick overhead (e.g., structural-skip work) which are diluted at higher mutation rates.

Changes:

  • Added -IncludeSkipFloor (default on) and -SkipFloorPercent (default 0) to the perf runner and implemented a second interleaved main/PR macro loop tagged main-floor/pr-floor, with results serialized into result.json.
  • Added Format-PerfSkipFloorSection and threaded floor aggregates into Format-PerfComment, plus unit tests that validate omission/ordering and per-metric direction awareness.
  • Updated methodology/docs and refreshed the workflow header comment to reflect the expanded comment layout.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/stress_perf/METHODOLOGY.md Documents rationale for the new low-mutation skip-floor leg and how it isolates the O(n) skip-walk floor.
tests/stress_perf/ci/RunPerfBenchmark.Tests.ps1 Adds assertions that Invoke-OneRun correctly threads --percent via the new -RunPercent parameter.
tests/stress_perf/ci/Run-PerfBenchmark.ps1 Adds new params + a second interleaved macro leg at -SkipFloorPercent, keeps paired runs index-aligned, and threads floor aggregates into outputs.
tests/stress_perf/ci/README.md Updates CI usage docs and comment layout description to include the skip-floor section.
tests/stress_perf/ci/PerfLib.Tests.ps1 Adds coverage for rendering/omission/placement of the skip-floor section and direction-aware statuses.
tests/stress_perf/ci/PerfLib.ps1 Implements the skip-floor renderer and integrates it into the main comment formatter.
.github/workflows/perf-compare.yml Updates workflow header comment to describe the expanded multi-section perf comment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/stress_perf/ci/PerfLib.ps1 Resolved
The skip-floor table renders all four headline metrics with their own
direction arrows, including Renders/sec (higher is better), so a blanket
'lower is better' in the preamble contradicted the per-row arrows. Drop the
clause (matching the headline Table 1 intro, which carries none) — direction
is conveyed per-row and by the comment's global footnote legend.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread tests/stress_perf/ci/PerfLib.ps1 Resolved
Comment thread tests/stress_perf/ci/PerfLib.Tests.ps1 Resolved
- Preamble no longer asserts 'virtually no cell changes' for every -Percent (it
  is configurable). Reword as a trend: few cells mutate per tick (always >=1) and
  the closer --percent is to 0, the more the O(n) skip-walk floor is the signal.
- Correct the test fixture comment: rps/reconcile/diff move down main->PR while
  memory is held flat as a within-noise control (not 'EVERY metric moves DOWN').

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants