PHASE_MANA_SOURCE_SORT_KEYS_LEGACY · branch loop/it23 · base 4ec0b9ef1 · candidate 4379c958a · took 1h 3m| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 22,096,806,856 | 22,096,208,951 | 4,000 | 5,524,127 | 2,454 | 2,294 |
| optimized | 22,092,503,041 | 22,093,975,003 | 4,000 | 5,523,310 | 3,570 | 3,486 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | -1.81% — cycles-neutral (same-arm spread 6.77%) | same within noise |
| IPC (instructions per cycle, higher is better) | 1.007 / 0.997 | same |
| backend stall / frontend stall (share of cycles) | 22.2% / 20.0% · 39.0% / 41.7% | more waiting |
| L1D / L2D refills per 1k instructions (cache misses) | 12.76 / 12.69 · 11.17 / 11.32 | same |
| branch mispredicts per 1k instructions | 5.904 / 5.928 | same |
| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 81,053,635,628 | 81,046,657,717 | 11,418 | 7,098,454 | 19,852 | 13,045 |
| optimized | 80,987,625,210 | 80,988,460,138 | 11,418 | 7,093,015 | 18,983 | 12,730 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | -0.63% — cycles-neutral (same-arm spread 4.13%) | same within noise |
| IPC (instructions per cycle, higher is better) | 0.893 / 0.901 | same |
| backend stall / frontend stall (share of cycles) | 23.3% / 22.5% · 41.9% / 42.5% | same |
| L1D / L2D refills per 1k instructions (cache misses) | 16.78 / 16.76 · 13.48 / 13.55 | same |
| branch mispredicts per 1k instructions | 5.283 / 5.363 | same |
Mechanism. In casting_costs.rs::collect_sorted_auto_tap_source_options, sort_by_key repeatedly evaluates a key that looks up the source in ObjectStore and inspects its card types and supertypes. Use stable sort_by_cached_key in the optimized arm so each option's unchanged key is computed once.
Evidence. The existing auto_tap_source_discovery_ms counter measured 512 ms out of 30,469 ms contract+apply (1.68%) across 11,418 actions in bench/reports/it19-ir4k-20261002-032339-legacy.json. That pair passed equal-work and fingerprint checks. This bounds the containing discovery region; sorting has no separate timer. The xn5.67 profile at docs/stage0-decision-memo.md:L4904 independently identifies auto-tap as an 18.1% inclusive family, which must not be added to the discovery timer.
Counter and kill threshold. auto_tap_source_discovery_ms: 1.68% diagnostic containing-region share. Expected instruction reduction: 0.3–0.7% per action, an unmeasured hypothesis; key computation's fraction is unknown. Expect marginal if successful, with the loop's 4,000-action gate deciding.
Invariant. Source collection and the lexicographic key remain identical. State is immutable throughout sorting, and equal keys retain original option order. Therefore the entire ordered option vector, selected sources, action stream and final state must match.
| Role | Harness / model | Time | Exit | Tokens in / out | Note |
|---|---|---|---|---|---|
| planner | codex / gpt-6.1-sol | 8m 49s | 0 | 3,039,451 / 10,486 | |
| executor | codex / gpt-6-luna | 31m 34s | 0 | 7,540,633 / 14,530 | |
| reviewer | codex / gpt-6.1-sol | 0m 34s | 0 | 22,474 / 543 |
| 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 it23-build |
| ir1k | pass | 0 | Ir -0.01% within +/-1%, same-arm spread 0.0095% | optimized 22,092,895,812 vs legacy 22,095,904,484 instructions; fingerprints match: True |
| ir4k | FAIL | 0 | Ir -0.08% within +/-1%, same-arm spread 0.0356% | optimized 80,992,850,042 vs legacy 81,058,603,116 instructions; fingerprints match: True |
Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)
Automated loop result on homelab (aarch64). Switch PHASE_MANA_SOURCE_SORT_KEYS_LEGACY, mechanism class compute. Mechanism: In casting_costs.rs::collect_sorted_auto_tap_source_options, sort_by_key repeatedly evaluates a key that looks up the source in ObjectStore and inspects its card types and supertypes. Use stable sort_by_cached_key in the optimized arm so each option's unchanged key is computed once. Invariant: Source collection and the lexicographic key remain identical. State is immutable throughout sorting, and equal keys retain original option order. Therefore the entire ordered option vector, selected sources, action stream and final state must match.
| 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.01% within +/-1%, same-arm spread 0.0095% |
| ir4k | NO | Ir -0.08% within +/-1%, same-arm spread 0.0356% |
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:14 · read-only · refreshes every 30 s