Repository navigation
Perf: bulk sidebar reorder, skip unchanged/collapsed fit, wave-free sizeHint, cached floating_covers - #2343
Merged
Conversation
…izeHint, cached floating_covers
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
Eliminates the remaining 258 ms
MetaCall/_UiThreadCallProxyGUI stall on#commsopen / sidebar sync and dropsVirtualRowCanvas.scrollContentsBy+QtHistoryWindow.floating_coverscompletely off theFrameProbetop-samples radar:Bulk reorder in
TreeItemRows._order_rows_immediate()(src/toad/qt/window.py:723-748)order_rowsmoved 74 out-of-placeThreadLinechildren one-by-one viatakeChild+insertChild(148rowsRemoved/rowsInsertedsignals). Each signal clearedMultilinePreviewItemDelegate._rowsand forcedQTreeViewto re-runsizeHint->StyledTextRenderer.prepareacross every visible row (4,673calls for 89 visible rows!).itemWidget, replaces the children in one bulktakeChildren()+addChildren(ordered)pair (2 signals instead of2N), preserving expanded/selected state.Skip no-op
SidebarItem.fit()writes and collapsed subtrees on resize (src/toad/qt/window.py:200,237-241,270-276,829,966-978)SidebarItem._fitted_layout = (name, prefix, summary)sofit()skipssetData(0, LAYOUT_ROLE, ...)(and itsdataChanged->forget_rangeinvalidation) when elided text is unchanged (96% of rows on resize).visible_subtree()instead ofsubtree()inConversationRows.resizeEventand connectsitemExpandedto_fit_expanded_childrenso collapsed channels cost 0 work on resize and refit lazily on expand.Skip bold/band layout cloning in
QtNameWaveDelegate.sizeHint()(src/toad/qt/name_wave.py:214-223)bold_titledandbaked_band_layoutpreserveprepared.sizeidentically; temporarily sets_active_wave = (False, None)duringsizeHintso measurement never clones waveQTextLayouts.Cache
QtHistoryWindow.floating_covers()(src/toad/qt/history.py:1345-1361,1518,1657-1709,2309-2326,src/toad/qt/virtual_scroll.py:1247-1251)(covers, opaque)across steady scroll frames and invalidates wheneversticky_header,jump_bar, or_viewportresizes, moves, or changes visibility, pairing with identity-hit lookup inVirtualRowCanvas.scrollContentsBy.Measured Before vs After (
#comms,412x915, live bus)StyledTextRenderer.prepare()calls: 4,687 -> 561 (8.35x fewer, -88%)StyledTextRenderer.prepare()calls: 98 -> 4 (24.5x fewer, -96%; collapsed fits 165 -> 0)FrameProbe#commsopen / sidebar sync window:slow MetaCall/_UiThreadCallProxy(>=100 ms): 258 ms -> 0 slow events (was 354 ms before#2342)worst_stall_ms: 290.7 ms -> 63.0 ms (4.6x faster vs#2342, 6.2x faster vs pre-#2342391.4 ms)MetaCall/_UiThreadCallProxytotal: 373 ms -> 108 ms (3.5x faster)loop_busy: 12% -> 6% (was 15%)FrameProbe5 s#commsfling:VirtualRowCanvas.scrollContentsBy(0.7%) +QtHistoryWindow.floating_covers(0.6%): both dropped completely off the top-14 sample list (<0.2%)QtHistoryWindow.viewportEvent: 1.3% -> 0.9%