Repository navigation
Qt paint: cache per-frame font_spec/layout_width in HistoryRowDelegate and view/viewport/wrap in QtNameWaveDelegate - #2339
Merged
Conversation
…e and view/viewport/wrap in QtNameWaveDelegate
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.
Numbers first
HistoryRowDelegate.paint_row/paint_pictures, 6 visible rows x 1,000 frames):[63.38, 67.52, 67.38, 68.50]-> median67.45 ms[51.13, 53.63, 51.92, 52.85]-> median52.39 ms(1.29xspeedup)QtNameWaveDelegate.paint, 12 rows x 2,000 frames):[139.06, 126.79, 130.28, 136.13]-> median133.21 ms[111.17, 117.41, 105.81, 107.73]-> median109.45 ms(1.22xspeedup)What changed
HistoryRowDelegateper-framefont_spec&layout_widthcaching (src/toad/qt/history.py:184, 601-676):_resolve_frame_paint(painter, viewport_width)now resolves(font_family, font_size)andlayout_widthonce inbegin_paintinstead of re-enteringlayout_width()(viewport().width()),preparation_key_for(),fragment_key(),drawn_key(), and_font_spec()(QFont::operator==) on every visible row of every scroll frame.paint_pictures()looks upself._documentsdirectly with the per-frame key (callingmove_to_endon hit and falling back tofinal_document_foron miss).QtNameWaveDelegate.paintcached view/viewport + wrap fast path + idle/waving variant fix (src/toad/qt/name_wave.py:112-197):self._view = self.parent()andself._viewport = self._view.viewport()in__init__and skipped redundantindex.model() is not self._rows_modelon_rowscache hits (eliminating two of the top Shiboken C++ boundary lookups per row paint).wrapsfromrow.wrap_mode.wrappeddirectly when set (falling back toview.wordWrap()only whenrow.wrap_mode is None) and reused it on cache misses instead of callingrow.wraps(view)twice.runningin the_row_imagesvariant key so idle(running=False, span=None)and bold waving between bands(running=True, span=None)cannot collide in the image cache.tests/model/test_android_perf_ux_arrivals.py,tests/textual/test_name_wave_repaint.py):HistoryRowDelegate._font_specruns once per frame across 5 painted rows.QtNameWaveDelegate._row_imageskeeps(running=True, span=None)and(running=False, span=None)distinct.Verification
pytest tests/model/test_android_perf_ux_arrivals.py tests/model/test_qt_history_width.py tests/textual/test_name_wave_repaint.pytools/qt_inherit_ratchet.py,tools/shadow_check.py,tools/guarded_imports.py,REL_IMPORTS=0