# Optimized profiling follow-up — 2026-09-12

Status: **complete**. The final disposition below supersedes pending wording in
the retained attempt history.

User instruction: “Go ahead” with optimized builds at the same Boid and Slime
workloads, measuring whole-frame cost. This is an extension of the completed
[eval-fix batch](20260912-eval-fixes.md), not a replacement of its evidence.

Starting revision: `10d24c4`. Existing unrelated working changes: AGENTS.md,
README.md, docs/implementation-plan.md, skills/README.md; untracked .agents/,
docs/example-integration-plan.md and docs/example-suite.md. Preserve them.

Selected work:

- P1: allow explicit optimized native builds through the existing runner, with
  profile-bound acceptance. Committed as `24c1895`; runtime verification pending.
- P2: retain callback and whole-frame samples for the same workload. Implemented; capture pending.
- P3: execute one fresh debug control and three release trials, unchanged seed,
  populations, steps, scene, window and pinned GL renderer. Pending.

Boid's 10,000-agent/600-step workload and Slime's 1024²/120,000-agent/800-step
workload remain fixed. Boid's matched 400-agent modes are additional evidence.
The SDK synchronous-consume comment is separately explained; no SDK change is
part of this profiling capture. Earlier original receipts stay immutable.

P2 was committed as `2b3cce6`. Initial Boid debug and release trials passed,
including CSV statistics and zero-owner teardown, but the first release finished
before CUA inspected it. Its sample is retained as an initial trial without
continuous focus evidence. A follow-up adds `Window.has_focus()` checks at every
measured entry; a windowed run with any unfocused sample fails after writing the
CSV. The exact dev5 Window XML confirms this public method. The helper costs are
outside callback timing and inside complete frame intervals. Headless results
remain explicitly unqualified for rendering/focus.

`d189d50` added focus evidence. Its first debug Boid run correctly rejected all
300 unfocused entries, with a zero-owner Host exit. This is retained as a negative
control, not performance evidence. The next fix waits for focus before step 1;
it never pauses or removes a sample after measurement begins. It also rejects
nonfinite printed timing values during CSV validation and corrects the copied
Boid screenshot explanation. Focused capture is pending on this next source.

`ede776a` qualified CSV finite-value rejection but two Boid foreground attempts
still failed (300 and 84 unfocused entries). A focus event at launch/inspection
can start a short benchmark before foreground acquisition is finished. The
windowed runner now adds `--eval-start-on-click`; an actual mouse event in the
focused scene starts step 1. The workload and all measured steps are unchanged.
This is an acquisition gate, not a pause/resume mechanism during measurement.
These rejected trials remain in the follow-up evidence and are not pooled.

## Final disposition and evidence

Evaluated runtime source: `aa63602` (full SHA in the receipt). Source hashes stayed
unchanged throughout the qualified campaign. `bd34cad` subsequently qualifies
Slime's README by native profile; no runtime source changed. P1/P2/P3 are verified
within the stated measurement bounds. The source fixes are `24c1895`, `2b3cce6`,
`d189d50`, `ede776a`, and `aa63602`; the acquisition failures above drove the last
three. `bd34cad` is the evidence-driven determinism documentation correction.

The [new receipt](../followups/20260912-optimized/receipt.json) retains every run
and failed acquisition attempt, exact commands/exits, raw CSV/PNG files, source
and tool hashes, final publication manifests, independent timing-validator
negative controls and the native codegen review. Original receipts and screenshots
remain byte-identical to `10d24c4`. No SDK or native algorithm was modified.

Commands: `GODODIN_PROFILE=debug ./test.sh pipeline` and the same with `release`,
then the original windowed mode in each profile. The native Host/image profile
changes Odin `-debug` / native emitter `-O0` to Odin `-o:speed` / emitter `-O2`.
The exact official `4.8.dev5.official.9552dfb68` Godot executable is unchanged,
including its `(DEBUG)` window title. These are not exported release-engine runs.
GL remains explicitly pinned with `--rendering-driver opengl3`. The retained
machine is macOS arm64 / Apple M5 Max, on AC power in normal power mode, with a
1280×720 captured viewport. Project renderer, window and pacing settings were
unchanged; no claim of an isolated GPU timer or continuously monitored display
presentation follows from frame-entry intervals.

| Accepted trial | Callback mean (ms) | Frame mean (ms) | Frame p95 (ms) | Frame max (ms) |
| --- | ---: | ---: | ---: | ---: |
| slime-debug-qualified-1 | 114.969 | 124.721 | 135.291 | 208.383 |
| slime-release-qualified-1 | 8.909 | 17.274 | 26.123 | 95.712 |
| slime-release-qualified-2 | 8.893 | 15.199 | 23.713 | 89.878 |
| slime-release-qualified-4 | 8.926 | 16.247 | 23.993 | 88.783 |

The three optimized large-workload trials have median frame mean **16.247
ms**, versus **124.721 ms** in the focused debug
control (7.68× ratio of observed frame means).
The optimized callback mean's median is **8.909 ms**. This is a native
build-profile comparison at the same configured workload, not a language-only
speedup, an integration-overhead subtraction, or a statistical significance claim.
Every accepted entry was focused (300 samples for Boid, 400 for Slime). Timing
sample arrays were allocated before timing; CSV output, final verification and cleanup
were outside the measured interval window. All accepted runs ended with zero
Host instances, foreign values, references, callback scopes and allocations.

The original windowed workload is unchanged: 1024² grid, 120,000 agents,
800 steps (400 warm and 400 callback samples), seed 20260911, speed 1.5 and gain
6. The third optimized attempt lost focus for all 400 measured entries; its CSV
and zero-owner failure are retained, and it is excluded. Trial four supplies the
third qualified sample. No slow accepted result was discarded.

Intermediate screenshots at steps 460 and 740 remain in the intervals arriving
at 461 and 741. The final screenshot is outside the sampled interval window.
This preserves the prior workload, including its capture overhead; the largest
roughly 89–96 ms optimized stalls are therefore retained and identified in the
receipt. The stats timer (including a whole-state digest) also runs normally.
Do not describe the result as pure steady-state GPU cost.

All four optimized attempts replay the same frame-16 digest
`-8523262832372737892`; debug replays `-1208778191915661261`. Cross-profile
bitwise equality is false. The [binary/numerical probe](../followups/20260912-optimized/slime-profile-fp-probe.json)
verified the exact image hashes and found separate `sinf`/`cosf` calls in debug,
paired `sincosf` in release, and three one-ULP discrepancies in 123 sampled
angles. It found no FMA instructions in either inspected native image. This
establishes a numerical execution difference; it does not locate the first diverging colony element or exclude
all other optimizer effects. The source audit found no uninitialized hashed
state. README now correctly requires identical build/profile and compiler/
emitter settings. CPU Image readback still agrees within each build; this is
not GPU texture readback or an independent simulation oracle.

Final verdict: the release result is a credible real-time native demo at this
large population, and the inspected developed networks remain visually coherent.
Its 24–26 ms p95 and retained capture stalls do not establish consistent 60 FPS.
The highest-value next step is an attributed frame trace, separating periodic
stats/capture work, rendering and pacing before choosing another optimization.
A GPU compute or same-algorithm GDScript comparison remains unmeasured. All
qualified screenshots were inspected. The ordinary runner still defaults to debug.

The SDK synchronous-consume comment remains a separately identified contract
wording issue. No design decision is needed to correct its overstatement; the
source is `tools/apigen/templates/rendering_facade.odin.txt:810`, and generated
bindings must follow the exact-dev5 authority publication workflow. Returning
from `multimesh_set_buffer` alone does not prove non-retention. Supporting queued,
interpolated or cached consumers transparently would be separate behavior/cost
work. This profiling batch makes no SDK fix or support claim.

Final process inventory: zero Godot processes. The original pure subsystem tests
and offline gates are reused because their source and tool identities are
unchanged; native runtime/readback/replay/lifetime checks were executed again in
both profiles. The remaining per-frame pacing/trace questions are measurements
for future optimization, not unresolved P1/P2/P3 implementation failures.
