Repository navigation
frame probe names every stall (Qt event or asyncio task); one-off actions reproduced at phone speed; tab switch and collapsed pane trimmed - #2106
Merged
Conversation
trissim
force-pushed
the
fork-qt-stall-attribution
branch
from
November 18, 2026 07:15
b3a7372 to
8aefda5
Compare
…io task and coroutine, behind every piece of work over 100 ms A probed run's QApplication times each event's whole delivery (ProbedApplication.notify) and every asyncio callback (TimedHandles), and writes a `slow` line naming it; Qt's operation tasks carry their OperationKind's name. Off unless asked for (TOAD_FRAME_PROBE, or the state folder's frame-probe file; on the phone files/state/toad/frame-probe). qt_drive's `actions` scenario taps the one-off actions cold, one probe window each. Tab switches no longer project every tab's label to find the selected index (tab_modes reads the modes from the tab order), and a collapsed thread pane follows the welcome instead of binding each opened conversation's settings and panels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…mark_current added) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim
force-pushed
the
fork-qt-stall-attribution
branch
from
November 18, 2026 07:21
8aefda5 to
cca7847
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.
The phone's probe log (#2102) showed one-off stalls of 1744, 901 and 339 ms, but not their causes. This PR makes the probe name every stall, reproduces the one-off actions cold at phone speed, and trims the per-open and per-switch work this PR owns.
1. The probe names each stall
The probe is still off by default. To turn it on: set
TOAD_FRAME_PROBE=1, or create the filefiles/state/toad/frame-probe(on the phone,adb shell run-as org.toadcomms.toadcomms touch files/state/toad/frame-probe, then relaunch). It logs tofiles/state/toad/logs/frame-probe.log. The module docstring now gives the post-#2091 path.A probed run writes one
slow <ms> <what>line for every piece of work longer than 100 ms:QApplicationis aProbedApplication, whosenotifytimes each event's whole delivery. The line names the event type, the receiver's class and object name, and the nesting depth. All three QApplication creation sites go throughFrameProbe.application:qt/main.py,qt/android.pyandqt_drive.TimedHandlestimes every callback qasync runs from its Qt timers, and names a slow one's task and coroutine. Qt'srun_operationnow names each task after itsOperationKind, so an operation reads as e.g.task=SessionRequestApply coroutine=TargetOpen.apply.Cost:
ProbedApplication.notifyputs every Qt event through Python, which adds roughly 30% while many widgets are being built (Settings, a view's construction). The probed log is for attributing stalls; take timings from unprobed runs. All numbers below are unprobed.2. One-off actions, cold, at phone speed
The new
qt_drive.py actionsscenario taps each action the way a finger does (QTestclicks on the row, the tab, the menu), each one cold and in its own probe window. Runs were at phone speed: one core at a 45% quota (the Pixel runs Python 2.15× slower than this desktop), offscreen, against the live bus. Worst stall per action on mainf49a87a1, with the attributed cause from the probed run:QtSettingsScreen.__init__→build_pages→FormFamily.pages(every page's editors at once). The startup fork owns this fix, so it is not changed here. On the phone, this is the most likely source of the 1,744 ms stall.TargetOpen.apply554 ms (probed). About 365 ms of it isConversationView→view_settings.configuration_state→ObjectConfiguration→objectstate: the first time a settings class is made lazy and its annotations are resolved (get_type_hints,annotationlib.__forward_code__). ThenWorkingTranscript.executeat 190 ms.TargetOpen.apply329 ms (probed) andWorkingTranscript.execute149 ms. The view's ownObjectStatebuild costs about 125 ms per view, and the new page's first row layout about 260 ms (sizeHintplus_update_viewport, each row laid out as plain text and again as prepared HTML).ThreadOpening.run320 ms (probed):configuration_state125 ms, the composer's construction 155 ms (one tick later), and the goal bar's firstpresent_state40 ms.mark_current, plusTranscriptPresentation.published131 ms (probed)3. Fixed here (both the per-open and the per-switch paths)
mark_currentbuilt every tab's label just to find the selected index. It ransession_navigation.tabs→connection.tab→history_entry.tab→project_valuefor every tab.SessionNavigator.tab_modesnow reads the modes from the tab order, since a tab's mode is its identity's.mark_currentruns on every open, every switch, and everypaint_tabs, which is every bus change.Times for the changed paths, from one run of
actionsper tree with the per-call timers on:thread_pane.bind, median / maxthread_pane.setting_entries, callsmark_current, maxpresent_panes, medianThe worst-stall-per-action table, run once per tree, is dominated by live-bus traffic landing in the same window. A single run moved by ±100 ms in both directions, which is more than these changes remove, so the per-call times above are the measure.
Not fixed here (other owners)
objectstateclass setup: inobjectstate(lazy_factory.make_lazy_simple, plus the type-hint resolution underObjectState.__init__and__init_with_tracking__). Fix it in objectstate, or prewarm it inCorePrewarmbefore the first frame (startup).ObjectStatebuild, about 125 ms per opened conversation:objectstate_compute_resolved_snapshot→to_object→_reconstruct_from_parameter_snapshot.RowDocumentDelegate._row_prepared→rows_changed, in pyqt-reactive andqt/history.py).Checks on
b3a73723(mainf49a87a1; the last commit only refactors the scenario timers)ProbedApplicationandTimedHandlesare inQT_ONLYwith reasons.shadow_check: 0.tools/android/check.sh: exit 0; the shipped app ran every view kind and bound key on a scratch bus.placement8/8,chrome9/9,menu12/12,tabs5/5,history7/7, with no tracebacks.SessionNavigator.tab_modes, a new property; nothing else on the TUI side changes.🤖 Generated with Claude Code
https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3