PHASE_MANA_DEFINITION_VIEW_LEGACY · branch loop/it27 · base 4ec0b9ef1 · candidate 36b2f3f33 · took 1h 47m| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 22,100,040,959 | 22,099,342,445 | 4,000 | 5,524,923 | 2,695 | 2,473 |
| optimized | 22,074,485,458 | 22,072,580,058 | 4,000 | 5,518,383 | 3,071 | 2,983 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | +0.99% — cycles-neutral (same-arm spread 5.58%) | same within noise |
| IPC (instructions per cycle, higher is better) | 1.015 / 1.031 | same |
| backend stall / frontend stall (share of cycles) | 19.3% / 20.5% · 42.1% / 40.1% | less waiting |
| L1D / L2D refills per 1k instructions (cache misses) | 12.62 / 12.69 · 11.29 / 11.11 | same |
| branch mispredicts per 1k instructions | 5.623 / 5.660 | same |
| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 81,044,317,826 | 81,066,912,176 | 11,418 | 7,098,933 | 19,967 | 13,706 |
| optimized | 80,919,927,846 | 80,923,137,234 | 11,418 | 7,087,190 | 18,450 | 12,273 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | +0.52% — cycles-neutral (same-arm spread 3.18%) | same within noise |
| IPC (instructions per cycle, higher is better) | 0.914 / 0.915 | same |
| backend stall / frontend stall (share of cycles) | 25.3% / 25.6% · 39.1% / 38.8% | same |
| L1D / L2D refills per 1k instructions (cache misses) | 16.75 / 16.75 · 13.45 / 13.57 | same |
| branch mispredicts per 1k instructions | 5.247 / 5.259 | same |
Mechanism. At game/mana_abilities.rs:2281, mana_ability_definition deep-clones an AbilityDefinition on every lookup. Return a private definition holder backed by the source's existing Arc<Vec<AbilityDefinition>> and the selected index. Its owned variant preserves the current deep-clone path. Use the holder at the four existing callers without changing when definitions are selected.
Evidence. docs/profiles/perf-20261002-1221/summary.md measures AbilityDefinition::clone at 1.0–1.4% CPU across five windows, 1.3% in window 0; destruction owns another 0.5% across windows. These are family ceilings, not measurements of this lookup alone. The matching source inspection identifies repeated whole-definition copies. Memo xn5.67 at L4904 additionally bounds the enclosing mana-cost continuation family at 16.7% inclusive CPU; that overlapping share is not additional credit.
Counter and kill threshold. Existing October 2 AbilityDefinition::clone and drop_in_place<AbilityDefinition> profile rows. Expected reduction: 0.4–0.9% instructions per action at 4,000 actions, an unmeasured hypothesis likely to be marginal. The lookup's exclusive fraction is unknown, and instruction counts can under-report copy savings.
Invariant. Preserve live-definition precedence over ability_snapshot, lookup timing, ability indices, errors, payment order and all fingerprints. Holding the abilities Arc preserves the selected definition across subsequent source mutation just as the old owned clone did. Each later stage must perform its original fresh lookup. Permanently compare both arms for live/snapshot disagreement, missing sources, same-revision ability replacement, source sacrifice, suspended payment and fork isolation.
| Role | Harness / model | Time | Exit | Tokens in / out | Note |
|---|---|---|---|---|---|
| planner | codex / gpt-6.1-sol | 8m 59s | 0 | 3,131,244 / 10,389 | |
| executor | codex / gpt-6-luna | 1h 15m | 0 | 50,143,199 / 44,232 | |
| reviewer | codex / gpt-6.1-sol | 0m 36s | 0 | 20,935 / 837 |
| Gate | Result | Exit | Detail |
|---|---|---|---|
| fmt | pass | 0 | cargo fmt --all -- --check |
| build | pass | 0 | pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it27-build |
| ir1k | pass | 0 | Ir -0.13% within +/-1%, same-arm spread 0.0160% | optimized 22,072,675,232 vs legacy 22,100,495,811 instructions; fingerprints match: True |
| ir4k | FAIL | 0 | Ir -0.16% within +/-1%, same-arm spread 0.0279% | optimized 80,926,514,016 vs legacy 81,057,683,743 instructions; fingerprints match: True |
Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)
Automated loop result on homelab (aarch64). Switch PHASE_MANA_DEFINITION_VIEW_LEGACY, mechanism class copy. Mechanism: At game/mana_abilities.rs:2281, mana_ability_definition deep-clones an AbilityDefinition on every lookup. Return a private definition holder backed by the source's existing Arc<Vec<AbilityDefinition>> and the selected index. Its owned variant preserves the current deep-clone path. Use the holder at the four existing callers without changing when definitions are selected. Invariant: Preserve live-definition precedence over ability_snapshot, lookup timing, ability indices, errors, payment order and all fingerprints. Holding the abilities Arc preserves the selected definition across subsequent source mutation just as the old owned clone did. Each later stage must perform its original fresh lookup. Permanently compare both arms for live/snapshot disagreement, missing sources, same-revision ability replacement, source sacrifice, suspended payment and fork isolation.
| gate | passed | detail |
|---|---|---|
| fmt | yes | cargo fmt --all -- --check |
| build | yes | pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa |
| ir1k | yes | Ir -0.13% within +/-1%, same-arm spread 0.0160% |
| ir4k | NO | Ir -0.16% within +/-1%, same-arm spread 0.0279% |
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:16 · read-only · refreshes every 30 s