Built-in system/mods-tab faults past its 5 ms longshot/ui flush budget (modsHost.tab) #3230

Open
opened 2026-12-05 04:39:41 +00:00 by Jer9 · 6 comments
Member

Longshot version

longshot pr-3223-a725d2de (source 429d93ea) (based on main @ 3a0f7d8f7).

What happened

During an in-game playtest, the built-in system/mods-tab mod faulted twice past its 5 ms CPU budget in longshot/ui flush while calling modsHost.tab:

[hos sead::MainThread] [error] script runtime: the built-in mod system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted: it ran past the 5 ms of CPU it may (6.0 ms of CPU, 13.0 ms on the wall clock: the API's calls 1.9 ms, 0.0 ms of CPU (1, the most modsHost.tab 1.9 ms in 1, 0.0 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~11.1 ms; 0.0 ms in the kernel (not counted), major page faults not counted here)
[hos sead::MainThread] [error] script runtime: the built-in mod system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted: it ran past the 5 ms of CPU it may (5.5 ms of CPU, 5.5 ms on the wall clock: the API's calls 1.2 ms, 0.1 ms of CPU (2, the most modsHost.tab 1.2 ms in 1, 0.1 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~4.3 ms; 0.0 ms in the kernel (not counted), major page faults not counted here)

Hardware & OS

  • OS: Windows 11 (build 26300)
  • CPU / RAM: AMD Ryzen AI 7 350 (16 threads), 26 GB usable
  • GPU / Driver: AMD Radeon(TM) 860M Graphics, Adrenalin 26.10.1 (LLPC)
### Longshot version `longshot pr-3223-a725d2de (source 429d93ea)` (based on `main @ 3a0f7d8f7`). ### What happened During an in-game playtest, the built-in `system/mods-tab` mod faulted twice past its 5 ms CPU budget in `longshot/ui flush` while calling `modsHost.tab`: ``` [hos sead::MainThread] [error] script runtime: the built-in mod system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted: it ran past the 5 ms of CPU it may (6.0 ms of CPU, 13.0 ms on the wall clock: the API's calls 1.9 ms, 0.0 ms of CPU (1, the most modsHost.tab 1.9 ms in 1, 0.0 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~11.1 ms; 0.0 ms in the kernel (not counted), major page faults not counted here) ``` ``` [hos sead::MainThread] [error] script runtime: the built-in mod system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted: it ran past the 5 ms of CPU it may (5.5 ms of CPU, 5.5 ms on the wall clock: the API's calls 1.2 ms, 0.1 ms of CPU (2, the most modsHost.tab 1.2 ms in 1, 0.1 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~4.3 ms; 0.0 ms in the kernel (not counted), major page faults not counted here) ``` ### Hardware & OS - **OS:** Windows 11 (build 26300) - **CPU / RAM:** AMD Ryzen AI 7 350 (16 threads), 26 GB usable - **GPU / Driver:** AMD Radeon(TM) 860M Graphics, Adrenalin 26.10.1 (LLPC)
Member

This looks like a valid bug report. I couldn't locate the cause in the code.

The reported faults are consistent with the code: the built-in Mods tab reads modsHost.tab during UI work, and later UI flushes have a 5 ms callback budget. The excerpts do not establish which work caused the overrun; the API call was only part of the reported time. I could not find an exact cause or verify the PR build's changes from this checkout.


For maintainers

The log shows faults in longshot/ui flush for system/mods-tab; no exact code cause has been established. Related open PR #3223 discusses system/menu faults, not this reported mods-tab call.

The checkout is at the reported main-branch base, 3a0f7d8f7; the reported PR source is a separate build, so its exact code could not be verified here. Blame attributes the useHost(host.tab) call and flush dispatch to d984fd704 (#2822). Investigate the complete flush, including host-value sharing and rendering, rather than attributing the overrun solely to modsHost.tab.

Seen in the code:

  • game/mods/mods-tab/src/main.tsx:646 — the Mods tab reads host.tab using useHost and subscribes to host changes.
  • game/modapi/ui/runtime.js:1458 — stale host reads run during a flush and share the returned value with the previous one.
  • game/crates/api/src/services/ui.rs:676 — the first UI flush gets a longer budget; subsequent flushes use the normal callback budget.
  • game/crates/script/src/limits.rs:19 — synchronous API work counts toward the callback budget; the normal limit is 5 ms.
  • game/crates/api/src/services/mods_host.rs:469 — the tab answer is prepared outside the script budget because creating it during a script read had previously approached or exceeded 5 ms.

Possibly related, for context:

  • PR #3223 WIP: fix(menu): keep renderer locks and upscaler_why out of declarations generation to prevent 5 ms menu faults — Open PR addresses a different built-in UI mod's 5 ms faults

Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.

**This looks like a valid bug report.** I couldn't locate the cause in the code. The reported faults are consistent with the code: the built-in Mods tab reads `modsHost.tab` during UI work, and later UI flushes have a 5 ms callback budget. The excerpts do not establish which work caused the overrun; the API call was only part of the reported time. I could not find an exact cause or verify the PR build's changes from this checkout. --- **For maintainers** The log shows faults in `longshot/ui flush` for `system/mods-tab`; no exact code cause has been established. Related open PR #3223 discusses `system/menu` faults, not this reported mods-tab call. The checkout is at the reported main-branch base, `3a0f7d8f7`; the reported PR source is a separate build, so its exact code could not be verified here. Blame attributes the `useHost(host.tab)` call and flush dispatch to `d984fd704` (#2822). Investigate the complete flush, including host-value sharing and rendering, rather than attributing the overrun solely to `modsHost.tab`. Seen in the code: - game/mods/mods-tab/src/main.tsx:646 — the Mods tab reads `host.tab` using `useHost` and subscribes to host changes. - game/modapi/ui/runtime.js:1458 — stale host reads run during a flush and share the returned value with the previous one. - game/crates/api/src/services/ui.rs:676 — the first UI flush gets a longer budget; subsequent flushes use the normal callback budget. - game/crates/script/src/limits.rs:19 — synchronous API work counts toward the callback budget; the normal limit is 5 ms. - game/crates/api/src/services/mods_host.rs:469 — the tab answer is prepared outside the script budget because creating it during a script read had previously approached or exceeded 5 ms. --- Possibly related, for context: - PR #3223 WIP: fix(menu): keep renderer locks and upscaler_why out of declarations generation to prevent 5 ms menu faults — Open PR addresses a different built-in UI mod's 5 ms faults --- <sub>Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.</sub>
Member

Second report, on a Steam Deck LCD running plain main (nightly-1118-3a0f7d8f, source 429d93ea), launcher install at 1280x800, the game at 21-24 fps, no player mods (the profile's mods folder is empty, only the built-in system mods run).

Both of the menu's system mods fault here, not only the Mods tab, and either one stopping gives the player the engine's fallback page.

system/mods-tab: seven faults in the session, 5.8 to 6.9 ms of CPU each. Every one is one or two host calls (modsHost.tab 1.0 to 2.3 ms), no garbage collection, no kernel time, and 4.1 to 5.6 ms of the tab's own JavaScript. Three in a minute stopped it (stopped after 3 faults in a minute, line 116819 of the run's log); it started again by itself once and stopped for good at line 116955.

system/menu: three faults in longshot/game frame listener at 5.9 ms, 52 API calls with settingsHost.decls on top (0.8 to 2.7 ms), 4.7 to 5.6 ms of its own JavaScript, then stopped (line 17982) and started again by itself once.

Repro, one action: open the Insert menu's Mods tab, open the FPS counter's page, and change its level from "FPS" to "Dev". In order, in the log: the write fires settingsHost.changed in system/menu (it re-lays out every tab, 34 major page faults paging in the rows), the Mods tab takes the only stateChanged re-read of the whole run (3.1 ms of CPU, 12.1 ms on the wall clock, 261 major page faults), the mods' scripts ran 7.3 ms of CPU together in one frame, and the counter then runs 2.1 to 2.9 ms of script CPU every frame for the rest of the session (no such warning anywhere before the change, 370 after). About 30 seconds later the Mods tab is over its 5 ms three times and stopped. The counter itself never faults.

Cadence: that burst sits between the present markers at frames 389800, 389912 and 390020, so this is not one 6 ms flush at every frame. One heavy repaint overruns the 5 ms, its render is deferred (defer(f) in game/modapi/ui/runtime.js), and the flushes that try to finish it overrun the same 5 ms: three inside FAULT_WINDOW_NS and the mod is stopped. The paging around it is logged separately and never counted, so the overrun is real CPU work.

One lead on the host side, read at 3a0f7d8f7 and not measured yet: mods_tab_json() reuses its TabMemo only when effects == m.effects, and every effect entry carries gpuMs. gpu/vk/vk_effects.cpp fills that from a moving average (f.gpu_ms = ef.samples ? ef.avg_us / 1000.0 : 0.0) that fx_poll() refreshes each frame. With any live effect (this run has vk: sharpness: 10% on the 3D scene before the HUD, 1280x800, B10G11R11) the average moves every frame, so while the tab is shown the memo cannot hit: mods_host_step rebuilds the whole tab JSON each frame, and each modsHost.tab() hands the script a fresh tree whose effects differ, so shareValue shares nothing and the rows render again. Keeping the live per-effect numbers out of the memoized answer, or comparing without gpuMs, or reading them only while a mod's page is open, is where I would look first. The other half is the part the render slice cannot interrupt: one component's render plus the tree diff, which is over 5 ms on this hardware on its own.

Related: #3223 covers the system/menu half, and the 5.9 ms settingsHost.decls faults in this log match its signature. It does not touch the Mods tab path, and since either mod stopping shows the fallback page, both halves need fixing. #3229 is the same reporter's row-disappearing bug seen on a #3223 build with system/menu at zero faults.

Log lines quoted above are from builds/default/diagnostics/logs/longshot_log.txt of the launcher's install; no game files are attached.

Second report, on a Steam Deck LCD running plain `main` (`nightly-1118-3a0f7d8f`, source `429d93ea`), launcher install at 1280x800, the game at 21-24 fps, no player mods (the profile's mods folder is empty, only the built-in system mods run). Both of the menu's system mods fault here, not only the Mods tab, and either one stopping gives the player the engine's fallback page. `system/mods-tab`: seven faults in the session, 5.8 to 6.9 ms of CPU each. Every one is one or two host calls (`modsHost.tab` 1.0 to 2.3 ms), no garbage collection, no kernel time, and 4.1 to 5.6 ms of the tab's own JavaScript. Three in a minute stopped it (`stopped after 3 faults in a minute`, line 116819 of the run's log); it started again by itself once and stopped for good at line 116955. `system/menu`: three faults in `longshot/game frame listener` at 5.9 ms, 52 API calls with `settingsHost.decls` on top (0.8 to 2.7 ms), 4.7 to 5.6 ms of its own JavaScript, then stopped (line 17982) and started again by itself once. Repro, one action: open the Insert menu's Mods tab, open the FPS counter's page, and change its level from "FPS" to "Dev". In order, in the log: the write fires `settingsHost.changed` in `system/menu` (it re-lays out every tab, 34 major page faults paging in the rows), the Mods tab takes the only `stateChanged` re-read of the whole run (3.1 ms of CPU, 12.1 ms on the wall clock, 261 major page faults), `the mods' scripts ran 7.3 ms of CPU together in one frame`, and the counter then runs 2.1 to 2.9 ms of script CPU every frame for the rest of the session (no such warning anywhere before the change, 370 after). About 30 seconds later the Mods tab is over its 5 ms three times and stopped. The counter itself never faults. Cadence: that burst sits between the present markers at frames 389800, 389912 and 390020, so this is not one 6 ms flush at every frame. One heavy repaint overruns the 5 ms, its render is deferred (`defer(f)` in `game/modapi/ui/runtime.js`), and the flushes that try to finish it overrun the same 5 ms: three inside `FAULT_WINDOW_NS` and the mod is stopped. The paging around it is logged separately and never counted, so the overrun is real CPU work. One lead on the host side, read at `3a0f7d8f7` and not measured yet: `mods_tab_json()` reuses its `TabMemo` only when `effects == m.effects`, and every effect entry carries `gpuMs`. `gpu/vk/vk_effects.cpp` fills that from a moving average (`f.gpu_ms = ef.samples ? ef.avg_us / 1000.0 : 0.0`) that `fx_poll()` refreshes each frame. With any live effect (this run has `vk: sharpness: 10% on the 3D scene before the HUD, 1280x800, B10G11R11`) the average moves every frame, so while the tab is shown the memo cannot hit: `mods_host_step` rebuilds the whole tab JSON each frame, and each `modsHost.tab()` hands the script a fresh tree whose effects differ, so `shareValue` shares nothing and the rows render again. Keeping the live per-effect numbers out of the memoized answer, or comparing without `gpuMs`, or reading them only while a mod's page is open, is where I would look first. The other half is the part the render slice cannot interrupt: one component's render plus the tree diff, which is over 5 ms on this hardware on its own. Related: #3223 covers the `system/menu` half, and the 5.9 ms `settingsHost.decls` faults in this log match its signature. It does not touch the Mods tab path, and since either mod stopping shows the fallback page, both halves need fixing. #3229 is the same reporter's row-disappearing bug seen on a #3223 build with `system/menu` at zero faults. Log lines quoted above are from `builds/default/diagnostics/logs/longshot_log.txt` of the launcher's install; no game files are attached.
Member

Measurements from a Deck after the report above, plus one correction to my first comment.

Correction. I wrote that the menu rebuilds on every frame. It does not. With HOS_EVENT_STATS=1, 3600 frames with the Insert menu open logged:

longshot/game frame listener 13 fires (13 listeners' calls; by system/menu)
longshot/settings-host changed listener 5 fires (5 listeners' calls; by system/menu)
longshot/mods-host stateChanged listener 1 fires (1 listeners' calls; by system/mods-tab)

So the menu lays out about a dozen times a minute. The problem is not the frequency, it is that one pass costs 5 to 6 ms on this CPU.

What one pass costs here (Steam Deck LCD, gameplay at 25-31 fps, nightly-1118 and a dev build of its parent 3a0f7d8f): the system/menu frame listener runs 52 API calls (0.9-1.6 ms) and 4.1-5.6 ms of its own JavaScript, 5.1-5.9 ms of CPU per pass. system/mods-tab's longshot/ui flush is 5.1-6.9 ms of CPU per pass, of which 4.5-5.0 ms is its own JavaScript and 1.0-2.3 ms is one or two modsHost.tab calls. Those numbers held across ten runs on two builds.

The structural point. These are Longshot's own built-in system mods, and the budget that stops them was written for third-party code: 5 ms a callback, three faults in a minute stops the mod for the session. For a player mod that is right. For the menu it converts "slow" into "the whole Insert menu is replaced by the fallback page", which is what the screenshot at the top of this issue shows, and on Deck-class hardware one ordinary layout pass is already at the limit.

What could land first, smallest change first.

  1. Keep the budget and the warnings for system mods, and stop counting them toward the three-fault stop. game/crates/script/src/runtime.rs's fault() already branches on self.system for the log wording; the stop is a few lines below it. The 500 ms OVERRUN_STOP_NS stop (runtime.rs:799-816) is a separate path and stays as the guard against a real freeze, so a built-in mod that hangs is still stopped at once. This turns a dead menu into a slow menu on hardware where it is 1 ms over, and it does not change anything for third-party mods. limits.rs says these numbers are the Mod API spec's, so a carve-out for built-ins is a spec decision, not a code one; I am putting it here because it is the only change that removes the player-visible failure today.
  2. Cut one pass: the listener's own JavaScript is the majority of it (4.1-5.6 ms of 5.1-5.9), so it needs to render less per pass or split a pass across frames. #3223 removes the declarations rebuild from that pass (measured on this Deck: settingsHost.decls 2.1 down to 1.5-1.6 ms, pass 5.5-5.9 down to about 5.1), which is real and not enough on its own.
  3. The Mods tab is separate: modsHost.tab hands the script a fresh tree per read, and mods_tab_json()'s memo requires the effects list to be equal, including gpuMs, which vk_effects.cpp fills from a live moving average. If the effects change every frame the memo cannot hit. I have not yet got the Mods tab hosted in a run to measure its stateChanged rate, so that one stays inferred; the numbers above are measured and are enough to say that even one repaint of the tab is over budget here.

Logs and the two dev runtimes are on the Deck if anyone wants them.

Measurements from a Deck after the report above, plus one correction to my first comment. **Correction.** I wrote that the menu rebuilds on every frame. It does not. With `HOS_EVENT_STATS=1`, 3600 frames with the Insert menu open logged: ``` longshot/game frame listener 13 fires (13 listeners' calls; by system/menu) longshot/settings-host changed listener 5 fires (5 listeners' calls; by system/menu) longshot/mods-host stateChanged listener 1 fires (1 listeners' calls; by system/mods-tab) ``` So the menu lays out about a dozen times a minute. The problem is not the frequency, it is that one pass costs 5 to 6 ms on this CPU. **What one pass costs here** (Steam Deck LCD, gameplay at 25-31 fps, `nightly-1118` and a dev build of its parent `3a0f7d8f`): the `system/menu` frame listener runs 52 API calls (0.9-1.6 ms) and 4.1-5.6 ms of its own JavaScript, 5.1-5.9 ms of CPU per pass. `system/mods-tab`'s `longshot/ui flush` is 5.1-6.9 ms of CPU per pass, of which 4.5-5.0 ms is its own JavaScript and 1.0-2.3 ms is one or two `modsHost.tab` calls. Those numbers held across ten runs on two builds. **The structural point.** These are Longshot's own built-in system mods, and the budget that stops them was written for third-party code: 5 ms a callback, three faults in a minute stops the mod for the session. For a player mod that is right. For the menu it converts "slow" into "the whole Insert menu is replaced by the fallback page", which is what the screenshot at the top of this issue shows, and on Deck-class hardware one ordinary layout pass is already at the limit. **What could land first, smallest change first.** 1. Keep the budget and the warnings for system mods, and stop counting them toward the three-fault stop. `game/crates/script/src/runtime.rs`'s `fault()` already branches on `self.system` for the log wording; the stop is a few lines below it. The 500 ms `OVERRUN_STOP_NS` stop (`runtime.rs:799-816`) is a separate path and stays as the guard against a real freeze, so a built-in mod that hangs is still stopped at once. This turns a dead menu into a slow menu on hardware where it is 1 ms over, and it does not change anything for third-party mods. `limits.rs` says these numbers are the Mod API spec's, so a carve-out for built-ins is a spec decision, not a code one; I am putting it here because it is the only change that removes the player-visible failure today. 2. Cut one pass: the listener's own JavaScript is the majority of it (4.1-5.6 ms of 5.1-5.9), so it needs to render less per pass or split a pass across frames. #3223 removes the declarations rebuild from that pass (measured on this Deck: `settingsHost.decls` 2.1 down to 1.5-1.6 ms, pass 5.5-5.9 down to about 5.1), which is real and not enough on its own. 3. The Mods tab is separate: `modsHost.tab` hands the script a fresh tree per read, and `mods_tab_json()`'s memo requires the effects list to be equal, including `gpuMs`, which `vk_effects.cpp` fills from a live moving average. If the effects change every frame the memo cannot hit. I have not yet got the Mods tab hosted in a run to measure its `stateChanged` rate, so that one stays inferred; the numbers above are measured and are enough to say that even one repaint of the tab is over budget here. Logs and the two dev runtimes are on the Deck if anyone wants them.
Member

I am taking the remaining Deck reproduction through a fix: repeated FPS counter level changes and supported Upscaler changes must leave both system/menu and system/mods-tab running. #3223 removes one declarations invalidation but did not clear that acceptance test here. Investigating the large snapshot conversion/sharing and synchronous layout work under the normal callback budget; not changing the budget or exempting system mods. Prior work checked: #3098, #3223, #3208, #3234 and #3238; no existing PR covers both remaining fault paths.

I am taking the remaining Deck reproduction through a fix: repeated FPS counter level changes and supported Upscaler changes must leave both system/menu and system/mods-tab running. #3223 removes one declarations invalidation but did not clear that acceptance test here. Investigating the large snapshot conversion/sharing and synchronous layout work under the normal callback budget; not changing the budget or exempting system mods. Prior work checked: #3098, #3223, #3208, #3234 and #3238; no existing PR covers both remaining fault paths.
Member

Cause narrowed on a Steam Deck, and it is not the read. Summary from tonight's runs, so the next attempt starts in the right place.

What I tried. I split a page's build in game/modapi/settings-host/store.ts into three frames (declarations read, then laid out, then its rows read) so that no frame both reads a page's declarations and writes every heading's word. On the Deck, both arms of the acceptance test (Upscaler changed 18 times with the real menu keys; FPS counter's level the same) were run on a build with that change and on the base build, each arm its own run.

arm before (3a0f7d8f7) with the split
Upscaler, 18 changes 6 system/menu faults, 2 stops 6 faults, 2 stops
FPS counter, 18 changes 1 fault, 0 stops 0 faults, 0 stops

So the split does not fix the Upscaler arm. The fault lines it produced are the useful part:

fault in longshot/game frame listener: interrupted: it ran past the 5 ms of CPU it may
(5.5 ms of CPU, 6.6 ms on the wall clock: the API's calls 0.2 ms, 0.0 ms of CPU
(51, the most i18n.t 0.2 ms in 51, 0.0 ms of CPU), the garbage collector 0.0 ms (0 runs),
its own JavaScript ~5.3 ms; ...)

With the read in an earlier frame the API is 0.1-0.2 ms and 51 i18n.t calls cost 0.0 ms. The remaining 5.5 ms is one page's render, all of it the menu's own JavaScript. On the base the same frame also carried the read (API 1.4-1.9 ms), which is why it looked like a read problem.

Why the slice does not save it. game/modapi/ui/runtime.js stops a flush between components once the frame has spent 0.5 ms (overSlice, SLICE_CPU_MS), but a page is drawn depth-first inside one component's render (SettingsPage -> PageRows -> its Sections and RowLines): the slice never gets a turn until the page is whole. One page of the Graphics tab is 5.5 ms of script on this CPU, so it lands past the 5 ms a callback may on its own, three of those in a minute stop system/menu, and the fallback page is what the player sees.

What would fix it (both are menu or engine changes, not a store one):

  1. Draw a page's rows in chunks across frames, as the menu already draws a tab's page out of sight one step a frame: the page appears over a few frames instead of one 5.5 ms frame.
  2. Or let the flush yield between a page's child components, so overSlice can cut a page's render the way it cuts between roots.

I have the patch for the three-frame split (it is a small, measured improvement in the read frame, just not a fix) and the run logs if either is wanted; I did not open a pull request for it, because it does not clear the complaint it was written for.

I also withdraw the carve-out I proposed earlier (system mods kept out of the three-fault stop): it hides the fault instead of making the work fit, and the measurement above shows the work is a single page render, not an unlucky threshold.

Cause narrowed on a Steam Deck, and it is not the read. Summary from tonight's runs, so the next attempt starts in the right place. **What I tried.** I split a page's build in `game/modapi/settings-host/store.ts` into three frames (declarations read, then laid out, then its rows read) so that no frame both reads a page's declarations and writes every heading's word. On the Deck, both arms of the acceptance test (Upscaler changed 18 times with the real menu keys; FPS counter's level the same) were run on a build with that change and on the base build, each arm its own run. | arm | before (`3a0f7d8f7`) | with the split | |---|---|---| | Upscaler, 18 changes | 6 `system/menu` faults, 2 stops | 6 faults, 2 stops | | FPS counter, 18 changes | 1 fault, 0 stops | 0 faults, 0 stops | So the split does not fix the Upscaler arm. The fault lines it produced are the useful part: ``` fault in longshot/game frame listener: interrupted: it ran past the 5 ms of CPU it may (5.5 ms of CPU, 6.6 ms on the wall clock: the API's calls 0.2 ms, 0.0 ms of CPU (51, the most i18n.t 0.2 ms in 51, 0.0 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~5.3 ms; ...) ``` With the read in an earlier frame the API is 0.1-0.2 ms and 51 `i18n.t` calls cost 0.0 ms. **The remaining 5.5 ms is one page's render, all of it the menu's own JavaScript.** On the base the same frame also carried the read (API 1.4-1.9 ms), which is why it looked like a read problem. **Why the slice does not save it.** `game/modapi/ui/runtime.js` stops a flush between components once the frame has spent 0.5 ms (`overSlice`, `SLICE_CPU_MS`), but a page is drawn depth-first inside one component's render (`SettingsPage` -> `PageRows` -> its `Section`s and `RowLine`s): the slice never gets a turn until the page is whole. One page of the Graphics tab is 5.5 ms of script on this CPU, so it lands past the 5 ms a callback may on its own, three of those in a minute stop `system/menu`, and the fallback page is what the player sees. **What would fix it** (both are menu or engine changes, not a store one): 1. Draw a page's rows in chunks across frames, as the menu already draws a tab's page out of sight one step a frame: the page appears over a few frames instead of one 5.5 ms frame. 2. Or let the flush yield between a page's child components, so `overSlice` can cut a page's render the way it cuts between roots. I have the patch for the three-frame split (it is a small, measured improvement in the read frame, just not a fix) and the run logs if either is wanted; I did not open a pull request for it, because it does not clear the complaint it was written for. I also withdraw the carve-out I proposed earlier (system mods kept out of the three-fault stop): it hides the fault instead of making the work fit, and the measurement above shows the work is a single page render, not an unlucky threshold.
Member

Numbers for current main on a Steam Deck LCD, and which of these reports the merged #3223 actually answers.

Setup: a Steam Deck LCD (SteamOS 20261023.100, kernel 7.2.7-valve2-2-neptune, RDNA3 APU), the base pack 3a0f7d8f7 with
two packs over it - rt-curmain (main 6b1694a, #3223 in) and rt-nofix (the same main with #3223's own merge diff
reverse-applied). Insert menu open on the Graphics page at 1280x800 windowed in Kokiri Forest, real menu_key presses,
the row re-found after each one, every change confirmed by option_get, and the game's own log lines counted. Runs at
$SD/longshot-dev/menu-cycle-runs/cm-* on that Deck, log cm.log.

arm                with #3223 on main              #3223's diff reversed out
Upscaler, 18       system/menu 3, mods-tab 1,      system/menu 2, mods-tab 2,
changes            1 stop (system/mods-tab)        0 stops
FPS Off..Dev,      system/menu 1, mods-tab 1,      system/menu 0, mods-tab 2,
20 changes         0 stops                         0 stops
Frame gen.         (only run on main with #3223: system/menu 3, mods-tab 2, 1 stop (mods-tab),
multiplier 2x..8x   values 2,3,4,5,6,7,8 and back)

So at this main, neither arm stops system/menu any more, with or without #3223. What #3223 measured was main at
7bc53f841: there the Upscaler cycle faulted 6 times and stopped system/menu in two runs out of two, the walk died
with row not found: Upscaler because the rows had gone, and the same cycle with its fix landed all 18 changes with 2
and 1 faults and no stop. main has moved a long way since then - #3208 took the Insert menu's logic out of the
renderer and #3234 cut the work the frame's status did - and at current main the menu's own listener is no longer
over budget by enough to stop on its own.

What does stop, on the same Upscaler arm, is system/mods-tab:

system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted:
it ran past the 5 ms of CPU it may (5.8 ms of CPU, 6.6 ms on the wall clock: the API's calls 3.0 ms, 2.0 ms of CPU
(1, the most modsHost.tab 3.0 ms in 1, 2.0 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~3 ms)

Three of those in a minute stopped it in that run, and the same shape came back on the Frame gen. multiplier arm (6
fault lines, modsHost.tab 2.6-3.0 ms, one stop). So a player on this hardware can still get the fallback page after
cycling Graphics rows - it is the Mods tab's mod dying, not system/menu, and the rows stay.

Read on the fake game (longshot-builder mod test game/mods/menu, current main, cpuScale 2.74), the FPS-counter path
this thread started on costs nothing now: one step of fps_counter costs 0.856 ms of script CPU in the frame after
the change and nothing in the frames after that, which is what flipping V-Sync costs too (0.835 ms, 0.831 ms, 0.842 ms). What is left on the menu's side is its frame listener at 5.5 ms in the same
frames as the Mods tab's read.

Claimed next: where the ~3 ms in one modsHost.tab call goes. In game/crates/api/src/services/mods_host.rs
mods_tab_json, the memo is thrown away whenever any mod page's screen effects moved (effects_all), and then the whole
tab is built again and copied and converted twice over (base.clone(), then Json::from_value). I have not measured
which of those three the 3 ms is yet; I will post that before proposing a change.

Numbers for current `main` on a Steam Deck LCD, and which of these reports the merged #3223 actually answers. Setup: a Steam Deck LCD (SteamOS 20261023.100, kernel 7.2.7-valve2-2-neptune, RDNA3 APU), the base pack `3a0f7d8f7` with two packs over it - `rt-curmain` (main `6b1694a`, #3223 in) and `rt-nofix` (the same main with #3223's own merge diff reverse-applied). Insert menu open on the Graphics page at 1280x800 windowed in Kokiri Forest, real `menu_key` presses, the row re-found after each one, every change confirmed by `option_get`, and the game's own log lines counted. Runs at `$SD/longshot-dev/menu-cycle-runs/cm-*` on that Deck, log `cm.log`. ``` arm with #3223 on main #3223's diff reversed out Upscaler, 18 system/menu 3, mods-tab 1, system/menu 2, mods-tab 2, changes 1 stop (system/mods-tab) 0 stops FPS Off..Dev, system/menu 1, mods-tab 1, system/menu 0, mods-tab 2, 20 changes 0 stops 0 stops Frame gen. (only run on main with #3223: system/menu 3, mods-tab 2, 1 stop (mods-tab), multiplier 2x..8x values 2,3,4,5,6,7,8 and back) ``` So at this `main`, neither arm stops `system/menu` any more, with or without #3223. What #3223 measured was `main` at `7bc53f841`: there the Upscaler cycle faulted 6 times and stopped `system/menu` in two runs out of two, the walk died with `row not found: Upscaler` because the rows had gone, and the same cycle with its fix landed all 18 changes with 2 and 1 faults and no stop. `main` has moved a long way since then - #3208 took the Insert menu's logic out of the renderer and #3234 cut the work the frame's status did - and at current `main` the menu's own listener is no longer over budget by enough to stop on its own. What does stop, on the same Upscaler arm, is `system/mods-tab`: ``` system/mods-tab faulted, a bug in Longshot (please report it with this log): fault in longshot/ui flush: interrupted: it ran past the 5 ms of CPU it may (5.8 ms of CPU, 6.6 ms on the wall clock: the API's calls 3.0 ms, 2.0 ms of CPU (1, the most modsHost.tab 3.0 ms in 1, 2.0 ms of CPU), the garbage collector 0.0 ms (0 runs), its own JavaScript ~3 ms) ``` Three of those in a minute stopped it in that run, and the same shape came back on the Frame gen. multiplier arm (6 fault lines, `modsHost.tab` 2.6-3.0 ms, one stop). So a player on this hardware can still get the fallback page after cycling Graphics rows - it is the Mods tab's mod dying, not `system/menu`, and the rows stay. Read on the fake game (`longshot-builder mod test game/mods/menu`, current main, `cpuScale 2.74`), the FPS-counter path this thread started on costs nothing now: one step of `fps_counter` costs 0.856 ms of script CPU in the frame after the change and nothing in the frames after that, which is what flipping V-Sync costs too (0.835 ms, 0.831 ms, 0.842 ms). What is left on the menu's side is its frame listener at 5.5 ms in the same frames as the Mods tab's read. Claimed next: where the ~3 ms in one `modsHost.tab` call goes. In `game/crates/api/src/services/mods_host.rs` `mods_tab_json`, the memo is thrown away whenever any mod page's screen effects moved (`effects_all`), and then the whole tab is built again and copied and converted twice over (`base.clone()`, then `Json::from_value`). I have not measured which of those three the 3 ms is yet; I will post that before proposing a change.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#3230
No description provided.