MTGBench improvement loop

Overview · Experiment index

Iteration 42: Skip journal reveal bookkeeping when no cards were revealed

state rejected — failed gate ir4k
switch PHASE_PUBLIC_REVEAL_SCAN_LEGACY · branch loop/it42 · base 4ec0b9ef1 · candidate ceaea7a57 · took 57m 44s

Results

Verdict: NO GAIN: 0.00% MORE instructions. Cycles moved +6.04%, within this machine's noise (±6.7%): 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.018%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0+0.00%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy21,779,775,49721,783,748,8224,0005,445,4412,6402,576
optimized21,780,693,83321,783,877,0774,0005,445,5712,8822,660
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+6.04% — cycles-neutral (same-arm spread 6.71%)same within noise
IPC (instructions per cycle, higher is better)0.987 / 1.021same
backend stall / frontend stall (share of cycles)16.8% / 17.2%  ·  44.4% / 42.7%same
L1D / L2D refills per 1k instructions (cache misses)12.90 / 12.84  ·  11.23 / 11.04same
branch mispredicts per 1k instructions5.729 / 5.768same
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.00% MORE instructions. Cycles moved -4.93%, within this machine's noise (±4.8%): 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.00% instructions, same-arm spread 0.005%, 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.00%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy78,429,141,44178,425,793,40111,4186,868,75719,34312,690
optimized78,432,194,31678,427,990,09511,4186,868,98717,57911,485
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.93% — cycles-neutral (same-arm spread 4.77%)same within noise
IPC (instructions per cycle, higher is better)0.912 / 0.876same
backend stall / frontend stall (share of cycles)21.6% / 19.2%  ·  42.4% / 46.5%more waiting
L1D / L2D refills per 1k instructions (cache misses)17.33 / 17.35  ·  13.41 / 13.77same
branch mispredicts per 1k instructions4.875 / 5.238fewer
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: 11 minexecutor: 31 minreviewer: 0 mingate fmt: 0 mingate build: 9 mingate ir1k: 1 mingate ir4k: 3 min
planner 11mexecutor 31mreviewer 0mgate fmt 0mgate build 9mgate ir1k 1mgate ir4k 3m
executor: 3,383,561 in / 11,423 out tokensplanner: 3,335,724 in / 13,671 out tokensreviewer: 20,380 in / 186 out tokens

Mechanism. In game/engine.rs::remember_public_reveals, the controller-reveal journal scan and HashSet construction run before checking whether events contains CardsRevealed. Return immediately when that event is absent; retain the existing body unchanged otherwise.

Evidence. docs/profiles/uprof-20261002-1125/w0-owners-all.txt attributes 3.1% directly owned CPU to finish_action_boundary_with_lifecycle, which calls this helper unconditionally. Across the summary's five windows, that owner ranges from 1.6% to 4.6%. This bounds the containing boundary work; reveal bookkeeping has no isolated timer. The profile predates subsequent loop changes.

Counter and kill threshold. Existing profile row: finish_action_boundary_with_lifecycle, 3.1% owned CPU in window 0. Expected instruction reduction: 0.3–0.8% per action at 4,000 actions, an unmeasured hypothesis. The removable fraction is unknown; expect marginal if successful. The loop's existing instruction and fingerprint gates decide.

Invariant. Without CardsRevealed, the existing helper performs no rules-state writes, so skipping its preparatory reads preserves the complete state. With a reveal event, retain controller-only reveal suppression, event order, journal_start handling, information commands and public knowledge updates exactly.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol11m 6s03,335,724 / 13,671
executorcodex / gpt-6-luna31m 24s03,383,561 / 11,423
reviewercodex / gpt-6.1-sol0m 12s020,380 / 186

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it42-build
ir1kpass0Ir -0.01% within +/-1%, same-arm spread 0.0366% | optimized 21,782,626,414 vs legacy 21,783,754,625 instructions; fingerprints match: True
ir4kFAIL0Ir -+0.00% within +/-1%, same-arm spread 0.0455% | optimized 78,418,891,487 vs legacy 78,422,534,900 instructions; fingerprints match: True

Write-up: 2026-10-03 - Loop iteration 42: Skip journal reveal bookkeeping when no cards were revealed (rejected)

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

Automated loop result on homelab (aarch64). Switch PHASE_PUBLIC_REVEAL_SCAN_LEGACY, mechanism class compute. Mechanism: In game/engine.rs::remember_public_reveals, the controller-reveal journal scan and HashSet construction run before checking whether events contains CardsRevealed. Return immediately when that event is absent; retain the existing body unchanged otherwise. Invariant: Without CardsRevealed, the existing helper performs no rules-state writes, so skipping its preparatory reads preserves the complete state. With a reveal event, retain controller-only reveal suppression, event order, journal_start handling, information commands and public knowledge updates exactly.

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

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:17 · read-only · refreshes every 30 s