Repository navigation
qt frame budget: measured stutter and tab-open stalls removed at their owners (sticky header, row roles, notifications, lazy panel pages, sidebar groups, GC freeze) - #2102
Merged
Conversation
trissim
force-pushed
the
fork-qt-frame-budget
branch
from
November 18, 2026 06:27
a7c6f51 to
f433fb1
Compare
…roll, tab open and bus changes Measured with the new env-gated probe (toad.qt.frame_probe: a 10 ms timer's lateness and key-to-paint latency) and qt_drive's `frame` scenario at phone speed (one core at 45% quota; the Pixel 8a runs Python 2.15x slower than this desktop): - sticky header: block_row built every block's html (a markdown parse) on every scroll offset before asking the height cache. The fragment now declares its header blocks (header_blocks), Qt measures only those, and a block's html is prepared only on a cache miss (PreparedOnFill). - history rows: the model built each row's plain text for every role Qt asked, and Qt asks on every paint and size. Only the asked role is answered, the delegate's style option no longer reads the text, and a row's height reads its formatting only on a miss. - visible-message notifications: an unchanged visible set no longer builds a fresh read every scrolled frame (the connection is asked whether the view still shows one). - thread pane: opening a tab built every setting's form at once (3.2 s at phone speed). A page's widget is built the first time it is shown (DeferredPanelEntry). - sidebar: each wholesale redraw rebuilt every channel's header controls. A kept row keeps its group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
… decision Textual's PanelMenu already mounted each panel only when it was selected; Qt's built every page, and every setting's form, as the menu listed them. The decision moves onto the shared PanelMenuModel (`page`, over each menu's `realize_page`), Textual's PanelMenu and Qt's QtPanelMenu both inherit it, and QtPanelEntry holds how its widget is built (`QtPanelEntry.of` for a widget that already exists). Opening a tab no longer builds its settings forms (thread_pane.setting_entries 3234 ms -> 40 ms median at phone speed). Android no longer turns on Qt's verbose platform logging by default: it was a diagnostic for the accessibility deadlock #2082 fixed, and an explicit QT_LOGGING_RULES still applies. FrameProbe and PreparedOnFill are Qt-only (QT_ONLY, with reasons). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…s; the frame scenario types both ways Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
… the first buildozer rewrites the app folder's dist while it packages it, so a build started meanwhile removed a file from under the first (FileNotFoundError on a bundled Qt library). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…llection walks only the run's new objects The frame probe now times Python's collections: the one long stall left in a phone-speed scroll was a full collection (487 ms, startup 1306 ms) walking every module, class and declared family the client made at startup. Both frontends' shared start collects once and freezes what is left (scroll gc max 487 -> 148 ms, startup 1306 -> 239 ms). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim
force-pushed
the
fork-qt-frame-budget
branch
from
November 18, 2026 06:30
f433fb1 to
7681a81
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tristan's phone stutters and lags. This PR measures where the Qt client's GUI thread goes at phone speed and removes the per-frame, per-tab and per-bus-change rebuilds the measurement found.
How it was measured
toad.qt.frame_probe.FrameProbe(new, off by default). It starts withTOAD_FRAME_PROBE=1or aframe-probefile in Toad's state folder; on the phone,run-as org.toadcomms.toadcomms touch files/app/state/toad/frame-probe. Every few seconds it writes a line to<state>/logs/frame-probe.logwith:qt_drive.py frame(new scenario). Phases:scratch-live-pipeline's composer, as hardware keys and as soft-keyboard preedit/commit, never sent.py-spy record --rate 200, restricted to the phase being measured.What the profiles found, and the fixes
block_rowbuilt every block's HTML, a full markdown parse, before asking the height cache. That was 27% of GUI time while scrolling.header_blocks,pinned_dividers).sticky_headerreads only those, so Qt measures only those, and a block's HTML is prepared only on a cache miss (PreparedOnFill).HistoryRows.databuilt the row's clipboard text for every role Qt asked, and Qt asks on every paint and size. That was 17.5% of a cold scroll.ReadNotificationsand compared it with the shown one.shows_notifications), so a hide that stopped the read is still caught. Published rows reset the check.PanelMenualready mounted a panel only when it was picked. That decision moves onto the sharedPanelMenuModel(page/realize_page), and both menus inherit it.QtPanelEntryholds how its widget is built (QtPanelEntry.offor an existing widget).QToolButtonwith its own stylesheet parse per channel.ApplicationLifetime.startcollects once the workspace is back, then callsgc.freeze(). Both frontends.qt.qpa.*) was on by default. It was a diagnostic for the accessibility deadlock that #2082 fixed.QT_LOGGING_RULESstill applies. Its on-phone cost is not measured: offscreen Qt logs almost nothing.p4a createrewrote the dist while the first was packaging it.tools/android/build.shtakes a lock on$APP/.build.lock, and a second build waits.Before and after (phone speed, desktop offscreen, live bus)
Main is
1aae804fwith only the probe added; the branch isa7c6f51c.present_panes), worstpresentper bus change, medianTyping was already cheap on the desktop at phone speed. The latency on the phone comes from the GUI thread being busy with the work above, or from Android's input-method bridge. The probe in this PR measures both on the device.
Not fixed here (measured)
present: up to 164 ms on a wholesale redraw.Checks on the final head
a7c6f51c(main1aae804f)FrameProbeandPreparedOnFillare inQT_ONLYwith reasons.shadow_check: 0.tools/android/check.sh: 21 (baseline 21).history7/7,sticky2/2,placement8/8,menu12/12,chrome9/9,composer6/6. The composer tracebacks are its deliberate failed send to#composer-drive-missing.frame-probe.logfrom it.🤖 Generated with Claude Code
https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3