MTGBench improvement loop

Overview · Experiment index

Iteration 6: Publish fixed journal-entry blocks during append

state retained — instruction-count retained; awaiting workstation wall-clock confirmation
switch PHASE_JOURNAL_FIXED_BLOCKS_LEGACY · branch loop/it6 · base 4ec0b9ef1 · candidate e410d1e91 · took 20h 44m

Results

Verdict: MARGINAL: 0.36% fewer instructions, between 0.3% and 1%. It is sent to the PC wall-clock check instead of being kept outright. The final word is always the PC wall-clock.
Gate: 1,000 actions (screen) — -0.36% instructions, same-arm spread 0.016%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-0.36%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy21,539,250,40321,537,812,6934,0005,384,6333,4233,598
optimized21,459,154,98121,462,610,0104,0005,365,2212,4762,470
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Verdict: GOOD: 3.38% fewer instructions, above the 1% bar. The final word is always the PC wall-clock.
Gate: 4,000 actions (verdict) — -3.38% instructions, same-arm spread 0.008%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-3.38%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy77,361,801,14577,358,228,63411,4186,775,26816,85911,336
optimized74,744,877,61974,750,951,94711,4186,546,49817,20212,072
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Gate: parity (7 seeds, decks rotate per seed)
coverage: 253 distinct cards cast, 35 action kinds, 41 decision kinds, 59 event kinds, max battlefield 35, max stack 5
coverage: 143 of 257 engine counters were nonzero somewhere (unioned over 7 seeds; decks rotate per seed)
parity: 1 matched, 6 matched with an engine rejection in both arms, 0 diverged, 0 arm failures; summary /data/mtgbench/edh-play/bench/reports/it6-parity-20261001-123632-parity.json
9 games ended early on an engine rejection (counted over both arms). A rejection that happens identically in both arms is a match, but those games never reach their late game, so late-game behaviour of those decks is not exercised.

Where the time went

planner: 11 minexecutor: 83 minreviewer: 1 mingate fmt: 0 mingate ir1k: 0 mingate ir4k: 2 mingate check: 32 mingate focused: 65 mingate build: 22 mingate parity: 5 minnot attributed: 1018 min
planner 11mexecutor 83mreviewer 1mgate fmt 0mgate ir1k 0mgate ir4k 2mgate check 32mgate focused 65mgate build 22mgate parity 5mnot attributed 1018m
executor: 17,857,339 in / 29,476 out tokensplanner: 1,696,685 in / 10,169 out tokensreviewer: 22,172 in / 1,280 out tokens

Mechanism. At types/resolved_commands.rs:1901–1930, replace only the journal entry vector with switchable fixed-block storage. Keep journals below 64 entries as a plain Vec; publish each completed 64-entry block by moving it into Arc-backed storage during append. Forks share completed blocks and copy at most 63 tail entries. Leave nodes, produced_mana, spent_mana and command payload types unchanged.

Evidence. xn5.67, docs/stage0-decision-memo.md:4904, attributes 5.7% inclusive process CPU specifically to the journal entry vector, within the 7.45% journal-clone family. xn5.36:2615 places most journal-clone time in the 64–1,000-entry bucket, with no measured >1,000-entry population. xn5.53B:3987 deferred the earlier implementation after neutral seed-91 results and a seed-42 instruction-profile-independent timing signal. These historical shares bound the opportunity; they predate subsequent retained changes.

Counter and kill threshold. Existing journal_clone_ns and journal_clone_ns_entries_64_to_1k counters, plus xn5.67's 5.7% entry-vector profile row. Expected instruction reduction: 0.8–2.0% per action at 4,000 actions, as a prediction rather than a measurement. Copy and allocation savings may land in the loop's marginal band despite a wall-clock benefit.

Invariant. Journal entries, ordinals, iteration order, probe reads and serialized arrays remain identical. Publishing a completed block changes ownership only; appending to a fork cannot modify its parent. Permanent differential tests must cover lengths 63/64/65 and 127/128/129, sibling appends, indexed reads, serialization roundtrips and any mutable indexed access retained for tests.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol11m 57s01,696,685 / 10,169
executorcodex / gpt-6-luna1h 23m017,857,339 / 29,476
reviewercodex / gpt-6.1-sol1m 1s022,172 / 1,280

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
ir1kpass0Ir -0.36% within +/-1%, same-arm spread 0.0161% | optimized 21,460,882,496 vs legacy 21,538,531,548 instructions; fingerprints match: True
ir4kpass0Ir -3.38% (threshold -1%), same-arm spread 0.0081% | optimized 74,747,914,783 vs legacy 77,360,014,890 instructions; fingerprints match: True
checkpass0
focusedpass0
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it6-build
paritypass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,13 -Actions 1000 -SkipBuild -CargoProfile bench-fast-inc -Label it6-parity

Write-up: 2026-09-30 - Loop iteration 6: Publish fixed journal-entry blocks during append (rejected)

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

Automated loop result on homelab (aarch64). Switch PHASE_JOURNAL_FIXED_BLOCKS_LEGACY, mechanism class copy. Mechanism: At types/resolved_commands.rs:1901–1930, replace only the journal entry vector with switchable fixed-block storage. Keep journals below 64 entries as a plain Vec; publish each completed 64-entry block by moving it into Arc-backed storage during append. Forks share completed blocks and copy at most 63 tail entries. Leave nodes, produced_mana, spent_mana and command payload types unchanged. Invariant: Journal entries, ordinals, iteration order, probe reads and serialized arrays remain identical. Publishing a completed block changes ownership only; appending to a fork cannot modify its parent. Permanent differential tests must cover lengths 63/64/65 and 127/128/129, sibling appends, indexed reads, serialization roundtrips and any mutable indexed access retained for tests.

gatepasseddetail
fmtyescargo fmt --all -- --check
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
ir1kyesIr -0.36% within +/-1%, same-arm spread 0.0161%
ir4kyesIr -3.38% (threshold -1%), same-arm spread 0.0081%
checkyes
focusedyes
parityNOpwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1

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

Write-up: 2026-10-01 - Loop iteration 6: Publish fixed journal-entry blocks during append (retained)

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

Automated loop result on homelab (aarch64). Switch PHASE_JOURNAL_FIXED_BLOCKS_LEGACY, mechanism class copy. Mechanism: At types/resolved_commands.rs:1901–1930, replace only the journal entry vector with switchable fixed-block storage. Keep journals below 64 entries as a plain Vec; publish each completed 64-entry block by moving it into Arc-backed storage during append. Forks share completed blocks and copy at most 63 tail entries. Leave nodes, produced_mana, spent_mana and command payload types unchanged. Invariant: Journal entries, ordinals, iteration order, probe reads and serialized arrays remain identical. Publishing a completed block changes ownership only; appending to a fork cannot modify its parent. Permanent differential tests must cover lengths 63/64/65 and 127/128/129, sibling appends, indexed reads, serialization roundtrips and any mutable indexed access retained for tests.

gatepasseddetail
fmtyescargo fmt --all -- --check
ir1kyesIr -0.36% within +/-1%, same-arm spread 0.0161%
ir4kyesIr -3.38% (threshold -1%), same-arm spread 0.0081%
checkyes
focusedyes
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
parityyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1

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