MTGBench improvement loop

Overview · Experiment index

Iteration 5: Share immutable boxed journal command payloads

state rejected — failed gate check
switch PHASE_JOURNAL_COMMAND_PAYLOAD_LEGACY · branch loop/it5 · base 96ebc3713 · candidate 8fcf20681 · took 2h 22m

Results

Verdict: GOOD: 1.14% fewer instructions, above the 1% bar. The final word is always the PC wall-clock.
Gate: 1,000 actions (screen) — -1.14% instructions, same-arm spread 0.023%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-1.14%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy21,519,912,33321,514,963,9324,0005,379,3602,3432,176
optimized21,270,902,94021,272,951,4664,0005,317,9822,3072,220
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: 4.42% fewer instructions, above the 1% bar. The final word is always the PC wall-clock.
Gate: 4,000 actions (verdict) — -4.42% instructions, same-arm spread 0.028%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-4.42%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy77,265,504,68877,272,943,45211,4186,767,31718,30912,450
optimized73,839,703,38773,860,659,20111,4186,467,87415,30610,293
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.

Where the time went

planner: 11 minexecutor: 80 minreviewer: 1 mingate fmt: 0 mingate build: 21 mingate ir1k: 0 mingate ir4k: 2 mingate check: 24 min
planner 11mexecutor 80mreviewer 1mgate fmt 0mgate build 21mgate ir1k 0mgate ir4k 2mgate check 24m
executor: 11,414,573 in / 21,611 out tokensplanner: 2,111,086 in / 10,509 out tokensreviewer: 21,710 in / 1,140 out tokens

Mechanism. At types/resolved_commands.rs:1331, replace the boxed command payloads with a transparent wrapper carrying either Box<T> or Arc<T>. Optimized journal clones share these immutable payloads; legacy clones retain owned boxes and deep-copy them. Keep the existing entry, node and mana vectors.

Evidence. xn5.67, docs/stage0-decision-memo.md:L4904, measured journal cloning at 7.45% inclusive CPU, with 5.7% in the entry vector. bench/reports/uprof-xn565-20260923-owners-alloc.txt attributes 1.9% process CPU to allocations owned by journal cloning. These bound the family, not the boxed-payload subset. xn5.71 subsequently removed trigger-entry deep copies, so its earlier share cannot also be credited here. Already overlaps the open xn5.23 clone sweep.

Counter and kill threshold. Existing journal_clone_ns and journal_clone_entries, plus xn5.67's 7.45% journal / 5.7% entry-vector profile rows. Expected instruction reduction: 0.6–1.5% per action at 4,000 actions, an unmeasured hypothesis; the boxed fraction is unknown and copy savings can be under-reported.

Invariant. Captured commands remain immutable and byte-equivalent across clones, serialization and replay. Preserve every journal reader, ordinal and causal/provenance relationship. Add a differential regression covering all converted variants, shared versus deep-copy ownership, divergent sibling appends, identical wire output, successful restoration and rejection of malformed authority.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol11m 13s02,111,086 / 10,509
executorcodex / gpt-6-luna1h 20m011,414,573 / 21,611
reviewercodex / gpt-6.1-sol1m 11s021,710 / 1,140

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it5-build
ir1kpass0Ir -1.14% (threshold -1%), same-arm spread 0.0230% | optimized 21,271,927,203 vs legacy 21,517,438,132 instructions; fingerprints match: True
ir4kpass0Ir -4.42% (threshold -1%), same-arm spread 0.0284% | optimized 73,850,181,294 vs legacy 77,269,224,070 instructions; fingerprints match: True
checkFAIL101

Write-up: 2026-09-30 - Loop iteration 5: Share immutable boxed journal command payloads (rejected)

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

Automated loop result on homelab (aarch64). Switch PHASE_JOURNAL_COMMAND_PAYLOAD_LEGACY, mechanism class copy. Mechanism: At types/resolved_commands.rs:1331, replace the boxed command payloads with a transparent wrapper carrying either Box<T> or Arc<T>. Optimized journal clones share these immutable payloads; legacy clones retain owned boxes and deep-copy them. Keep the existing entry, node and mana vectors. Invariant: Captured commands remain immutable and byte-equivalent across clones, serialization and replay. Preserve every journal reader, ordinal and causal/provenance relationship. Add a differential regression covering all converted variants, shared versus deep-copy ownership, divergent sibling appends, identical wire output, successful restoration and rejection of malformed authority.

gatepasseddetail
fmtyescargo fmt --all -- --check
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
ir1kyesIr -1.14% (threshold -1%), same-arm spread 0.0230%
ir4kyesIr -4.42% (threshold -1%), same-arm spread 0.0284%
checkNO

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