Repository navigation
Perf: eliminate O(N^2) sidebar row tones, cache notification_references and scroll cover clip - #2342
Merged
Conversation
…es and scroll cover clip
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.
Summary
Measured with
FrameProbeon live#comms(412x915Pixel 8a viewport) and fixed three verified hotspots:Eliminated O(N^2) sidebar row-tone storm (
src/toad/qt/window.py:199,694-715,861-890,958-962)ConversationRowsconnectedrowsInserted/rowsRemoveddirectly to_paint_children_tones(parent, first), which walkedrange(first, childCount())and calledchild.setBackground(0, brush)unconditionally on everyinsertChild/takeChildduring bulk sidebar updates andTreeItemRows.order_rows. EachsetBackgroundemitteddataChanged->MultilinePreviewItemDelegate.forget_range-> fullStyledTextRenderer.preparere-layout.ConversationRows.batching_row_tones()(used byConversationRows.redraw,TreeItemRows.reconcile_keys, andTreeItemRows.order_rows) to coalesce per-parent tone updates into oneO(N)pass at batch exit, and trackedSidebarItem._painted_toneso rows whose tone brush did not change skipsetBackgroundaltogether.Cached
notification_referencesonBusMessageHistoryFragment/WireMessage(src/toad/client/fragments.py:518,679)notification_referencesfrom@propertyto@cached_propertyso scroll notification checks stop re-mintingMessageId/SentMessageReferenceobjects on every visible-fragment scan.Cached steady overlay scroll clip/dirty regions in
VirtualRowCanvas.scrollContentsBy(src/toad/qt/virtual_scroll.py:911,1240-1272)(vp_rect, covers, opaque) -> (clear, dirty)so consecutive scroll frames with unchangedsticky_header/jump_barrectangles skipuncovered()and repeatedQRegionallocations/subtractions.Live
FrameProbeBefore vs After (#comms,412x915)#commsopen:_paint_children_tones: 3.5% -> 0.1% (35x reduction)MultilinePreviewItemDelegate.forget_range: 1.8% -> 0.3% (6x reduction)slow MetaCall/_UiThreadCallProxystall: 354 ms -> 258 ms (worst_stall_ms391.4 ms -> 290.7 ms)#commsscroll fling:WireMessage.notification_references/MessageId.mint: 0.9% -> 0.0%VirtualRowCanvas.scrollContentsBy+uncovered: 2.2% -> 0.7%worst_stall_ms9.9 ms -> 8.1 ms,Timer/_SimpleTimer934 ms -> 839 ms)