MTGBench improvement loop

Overview · Experiment index

Iteration 28: Materialize composite payment bookkeeping only at resolution

state rejected — failed gate ir4k
switch PHASE_COMPOSITE_RESOLUTION_BOOKKEEPING_LEGACY · branch loop/it28 · base 4ec0b9ef1 · candidate 4f6d039b7 · took 2h 4m

Results

Verdict: NO GAIN: 0.00% MORE instructions. Cycles moved -1.27%, within this machine's noise (±6.0%): the time effect is too small to see here; only the PC wall-clock can say. Cache misses and branch mispredicts per instruction are about unchanged, so no hidden cost shows up. The final word is always the PC wall-clock.
Gate: 1,000 actions (screen) — +0.00% instructions, same-arm spread 0.004%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0+0.00%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy22,096,582,74222,097,573,4924,0005,524,2702,9632,867
optimized22,097,993,61722,097,432,6824,0005,524,4283,7483,768
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Hardware counters (optimized / legacy)ValueReading
cycles, minimum of the repeats-1.27% — cycles-neutral (same-arm spread 5.98%)same within noise
IPC (instructions per cycle, higher is better)0.894 / 0.877same
backend stall / frontend stall (share of cycles)17.0% / 16.7%  ·  48.7% / 48.5%same
L1D / L2D refills per 1k instructions (cache misses)12.69 / 12.72  ·  11.46 / 11.38same
branch mispredicts per 1k instructions5.936 / 6.020same
Green = better, red = worse, grey = about the same (5% band). Cycles are the closest thing to time that the shared VM does not distort. Fewer instructions with more cycles means the saving does not show up as time; such a candidate goes to the workstation wall-clock instead of being retained.
Verdict: NO GAIN: 0.02% MORE instructions. Cycles moved +4.60%, within this machine's noise (±15.6%): the time effect is too small to see here; only the PC wall-clock can say. Cache misses and branch mispredicts per instruction are about unchanged, so no hidden cost shows up. The final word is always the PC wall-clock.
Gate: 4,000 actions (verdict) — +0.02% instructions, same-arm spread 0.016%, equal work: yes, fingerprints match: yes
Gate FAILED: the harness refused this A/B (exit 0); see the write-up below. These counts are not a valid measurement.
-1% retain-0.3% kill0+0.02%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy81,090,728,87381,077,612,20211,4187,101,43424,25416,283
optimized81,095,060,48681,099,456,52811,4187,102,58020,99213,865
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Hardware counters (optimized / legacy)ValueReading
cycles, minimum of the repeats+4.60% — cycles-neutral (same-arm spread 15.62%)same within noise
IPC (instructions per cycle, higher is better)0.801 / 0.790same
backend stall / frontend stall (share of cycles)21.4% / 22.6%  ·  47.0% / 46.1%less waiting
L1D / L2D refills per 1k instructions (cache misses)16.74 / 16.76  ·  13.70 / 13.75same
branch mispredicts per 1k instructions5.655 / 5.469same
Green = better, red = worse, grey = about the same (5% band). Cycles are the closest thing to time that the shared VM does not distort. Fewer instructions with more cycles means the saving does not show up as time; such a candidate goes to the workstation wall-clock instead of being retained.

Where the time went

planner: 7 minexecutor: 52 minreviewer: 0 minexecutor: 39 minreviewer: 0 mingate fmt: 0 mingate build: 17 mingate ir1k: 1 mingate ir4k: 4 min
planner 7mexecutor 52mreviewer 0mexecutor 39mreviewer 0mgate fmt 0mgate build 17mgate ir1k 1mgate ir4k 4m
executor: 9,560,444 in / 25,273 out tokensplanner: 2,104,637 in / 9,715 out tokensreviewer: 46,279 in / 1,601 out tokens

Mechanism. In costs.rs::pay_ability_cost_inner, the Composite arm clones waiting_for and constructs sub_resume_cost for every component, although both are consumed only in Resolution scope. Gate those constructions on Resolution scope. Preserve suffix construction when a component actually pauses, including activation pauses.

Evidence. xn5.67, docs/stage0-decision-memo.md:L4904, attributes 7.2% inclusive process CPU to pay_ability_cost_inner beneath activation payability. xn5.75 at L5537 records activation dry-run totals of 982.123 ms on seed 91 and 689.498 ms on seed 42. These are overlapping family ceilings, not measured removable shares; no suffix-specific timer exists. The source explicitly constructs owned suffixes before discarding their references in Activation scope.

Counter and kill threshold. Existing activation_dry_run timers and xn5.67's pay_ability_cost_inner profile row bound the containing work. Forecast: 0.5–1.2% fewer instructions per action at 4,000 actions, with substantial uncertainty about composite coverage. Copy and allocation savings may place this in the marginal band.

Invariant. Payment order, outcome, emitted events, waiting_for, and every paused unpaid suffix remain identical. Activation passes None as resume_cost today; removing the unused owned temporary must preserve that. Resolution keeps its full continuation bookkeeping.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol7m 48s02,104,637 / 9,715
executorcodex / gpt-6-luna52m 39s05,768,216 / 15,732
reviewercodex / gpt-6.1-sol0m 47s024,013 / 1,019
executorcodex / gpt-6-luna39m 21s03,792,228 / 9,541
reviewercodex / gpt-6.1-sol0m 30s022,266 / 582

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it28-build
ir1kpass0Ir +0.00% within +/-1%, same-arm spread 0.0048% | optimized 22,097,454,933 vs legacy 22,096,972,733 instructions; fingerprints match: True
ir4kFAIL0Ir +0.01% within +/-1%, same-arm spread 0.0261% | optimized 81,090,940,575 vs legacy 81,082,908,994 instructions; fingerprints match: True

Write-up: 2026-10-02 - Loop iteration 28: Materialize composite payment bookkeeping only at resolution (rejected)

Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)

Automated loop result on homelab (aarch64). Switch PHASE_COMPOSITE_RESOLUTION_BOOKKEEPING_LEGACY, mechanism class copy. Mechanism: In costs.rs::pay_ability_cost_inner, the Composite arm clones waiting_for and constructs sub_resume_cost for every component, although both are consumed only in Resolution scope. Gate those constructions on Resolution scope. Preserve suffix construction when a component actually pauses, including activation pauses. Invariant: Payment order, outcome, emitted events, waiting_for, and every paused unpaid suffix remain identical. Activation passes None as resume_cost today; removing the unused owned temporary must preserve that. Resolution keeps its full continuation bookkeeping.

gatepasseddetail
fmtyescargo fmt --all -- --check
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
ir1kyesIr +0.00% within +/-1%, same-arm spread 0.0048%
ir4kNOIr +0.01% within +/-1%, same-arm spread 0.0261%

Wall-clock confirmation on the workstation is required before this counts as a speedup; instruction count is a screen, not a time prediction.

generated 2026-11-28 18:17:12 · read-only · refreshes every 30 s