Skip to content

Defer scroll-motion notifications/reads/style, yield decorative chrome animations, and split PagedReader - #2363

Merged
trissim merged 1 commit into
mainfrom
perf/scroll-motion-deferral-and-reader-window
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/scroll-motion-deferral-and-reader-window

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown

Measured scroll-profile improvement (tools/qt_scroll_profile.py, Pixel 8a 412×915, live bus)

  • Profiled total (fling + wheel + arrival): 1.128s -> 0.747s (1.51x, -381 ms)
  • flush_qt_events: 288 ms -> 76 ms (3.79x)
  • paintEvent: 206 ms -> 88 ms (2.34x)
  • _scroll_frame (190 ms) / prepare_viewport (174 ms): vanished from top 35 (<20 ms)
  • check_notifications / WS send_bytes: 78 ms / 12 frames -> 0 mid-scroll
  • name_wave.py:149(paint): 118 calls / 19 ms -> 0 mid-scroll
  • Unprofiled wall-clock pageup frame median/p95: 0.992 / 11.745 ms -> 0.663 / 4.247 ms (2.77x p95), latency p95 328.3 -> 215.3 ms (-113 ms)
  • Unprofiled wall-clock arrival frame median/p95: 0.502 / 1.008 ms -> 0.377 / 0.659 ms (1.53x p95), latency median/p95 1.103 / 2.033 ms -> 0.904 / 1.647 ms

Changes

  1. Shared PagingWindow.scroll_in_motion deferral (client/history_pager.py, client/history_notifications.py, client/history.py, qt/history.py):

    • PagingWindow.scroll_in_motion (default False, overridden on QtHistoryWindow as self.actively_scrolling or self._settle_timer.isActive()) is the single owner for scroll-motion deferral.
    • SourceNotifications.notifications_deferred and HistoryNotifications.check_notifications defer WS notification re-subscriptions during scroll; deleted the duplicate Qt-only QtHistoryNotifications.check_notifications override.
    • ReadMarkedHistory.prepare_viewport, mark_visible_after_paint, and read_visible defer mark_visible RPCs and follow_message_style() ObjectState lookups while scrolling (while retain_painted keeps accumulating painted fragments so settle flushes reads in one RPC).
    • QtHistoryWindow._on_scroller_state flushes immediately via _settle() / request_preparation() when motion stops.
  2. QtAnimationClock decorative chrome scroll-yielding (qt/widget_animation.py, qt/window.py, qt/activity.py, qt/name_wave.py):

    • Added QtAnimationClock(AnimationClock) tracking active scrolling windows (set_scrolling(owner, active)).
    • Infinite decorative chrome targets (QtClockedWave, QtTabMarquee, ActivitySweep) yield animation_visible while scrolling so top-bar/sidebar/bottom-bar repaints stop expanding Android's backing-store dirty bounding box to a full-screen GPU upload mid-fling, while finite transitions (TabTransition, arrivals, fades) keep running.
  3. Eliminate IDEN-2 duplicate ReaderWindow in MRO (history_jump.py, reader_actions.py, transcript_publication.py, qt/history.py, widgets/history_anchor.py):

    • Renamed toad.history_jump.ReaderWindow -> PagedReader so QtHistoryWindow.__mro__ and HistoryWindow.__mro__ carry one ReaderWindow (toad.client.reader_position.ReaderWindow) and one PagedReader.
  4. Test cleanup:

    • Added unit test covering scroll-motion deferral (test_mobile_chrome_polish_and_suspend.py).
    • Updated Qt widget test fixtures to pass QtAnimationClock and replaced the stale _Renderer fake in test_qt_channel_activity_sidebar.py with QtLineRenderer + root.

Verification

  • pytest (6 affected test files): 117 passed in 1.26s
  • tools/qt_inherit_ratchet.py: 0 / 0 / 0 / 0 / 0
  • MRO check: single ReaderWindow + PagedReader on both frontends
  • REL_IMPORTS=0

@trissim
trissim merged commit 5784529 into main Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant