Repository navigation
perf(debug): bound the entity inspector's per-component code (labelle-engine#922) - #822
Conversation
…gine#922) The entity browser and detail windows are instantiated over a game's whole component registry. Before reshaping how that per-component code is generated, drive both windows against a mock game and a call-recording Gui and pin the exact transcript: Position first, every registered component in registry order with its fields, the "?" label for an over-long name, filters and the dirty flag, the component tag column, Select/Deselect, dead-entity handling and the 50-row cap. The plugin's test build has no labelle-core, so the position type is resolved lazily through `PositionOf(Game)`: a game may name it with a `DebugInspectorPosition` decl (only the tests do); every real game still gets `core.Position`. Claude-Session: https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
…-engine#922) `drawEntityDetail` and `drawEntityBrowser` walked the component registry with `inline for` bodies, so every component's filter checkbox (with a runtime bufPrintZ of its name), membership checks, tag text and detail tree (with every field's formatting) was expanded into the two draw functions. In Flying Platform's ReleaseSafe WASM build they were the 2nd- and 4th-largest functions: ~165 KB and ~85 KB. - Component labels are built at comptime (same "?" fallback for a name that does not fit the 128-byte label buffer). - The browser's filter, membership and tag walks are runtime loops over comptime tables: labels, and one noinline `has component` check per type. - Each component's detail tree is drawn by its own noinline `drawComponentNode`, instantiated once per type. The widgets drawn, their order, labels and the filter/dirty/selection behaviour are unchanged: the transcript tests added in the previous commit pass unmodified, in Debug and ReleaseSafe. Claude-Session: https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
apotema
left a comment
There was a problem hiding this comment.
Codex, OpenAI LLM — review of a81addad9e9d0b765340bb0947dc4f84e7886ce8.
No correctness findings in the inspector outlining diff. The fixed UI labels, truncated-name fallback, runtime row dispatch, component ordering, filtering, 50-entity cap, selection, and dead-entity handling remain consistent with the old path. PositionOf(Game) retains the fallback while allowing the test game override.
Validation: local plugin zig build test -j2 --summary all passes all 15 Debug tests; current-head GitHub CI run 41111827084 is successful. I did not perform an interactive FP inspector smoke test or repeat the WASM memory benchmark.
Consumption note: FP vendors plugins/debug; a toolkit/assembler pin bump alone will not deliver this optimization to FP. Re-vendor that plugin as part of consumer adoption, as the PR description already notes.
… inspector outlining (#826) Version-only release of #824 (manifest-v2 optional `.lazy` on root build deps; lazy-safe emsdk preflight, fixes #823) and #822 (debug entity inspector outlining, labelle-engine#922), part of labelle-toolkit/labelle-cli#528. Claude-Session: https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
Refs labelle-toolkit/labelle-engine#922 (labelle-toolkit/labelle-cli#528 WP2b). Draft. This is the inspector half; the startup and save-loader half is labelle-toolkit/labelle-engine#925, which is stacked on engine #921.
Why
In Flying Platform's ReleaseSafe WASM build, the debug plugin's
drawEntityDetail(~165 KB) anddrawEntityBrowser(~85 KB) were the 2nd- and 4th-largest functions. Both walk the whole component registry withinline for. That expands every component's code into the two functions: a runtimebufPrintZof its name, membership checks, tag text, and the detail tree with every field's formatting.Changes
test(debug)(first commit, on the unchanged code): pins the exact widget transcript of both windows against a mock game and a call-recording Gui. It covers:?label for an over-long name;The plugin's test build has no
labelle-core, so the position type is resolved lazily throughPositionOf(Game). Only the tests declareDebugInspectorPosition; real games still getcore.Position.perf(debug):?fallback.noinline"has component" check per type.noinline drawComponentNode.The engine registry's
names()returns a slice of a comptimevar, so the names are copied into a constant first. The mock now reproduces that.The transcript tests pass unmodified, in Debug and ReleaseSafe.
Result
In FP, with engine#925, both functions are gone from the top list. They are now small enough to inline into
drawGui, which is 26 KB. The before/after table for the whole of #922 is in labelle-toolkit/labelle-engine#925:game.wasm: −394 KBTests
cd plugins/debug && zig build test: 15/15 pass, in Debug and ReleaseSafe. Onmainit is 12/12; the 3 new tests are the inspector tests. Nothing outsideplugins/debugchanged, so I did not run the assembler's own suite.Follow-up
Flying Platform vendors this plugin as
plugins/debug(a byte-identical copy apart from line endings). It needs re-vendoring once this merges. My FP measurement clone used this version locally; nothing was committed to FP.Not validated
The inspector was not exercised in a browser or on desktop. Behaviour is covered only by the transcript tests.
https://claude.ai/code/session_01Hpt1haxcboZPznpG1KqDRS
Summary by CodeRabbit