Repository navigation
virtual rows: a layout lays out only the rows near the reader; the rest are measured between frames - #65
Open
trissim wants to merge 1 commit into
Open
virtual rows: a layout lays out only the rows near the reader; the rest are measured between frames#65trissim wants to merge 1 commit into
trissim wants to merge 1 commit into
Conversation
…st are measured between frames QListView asks every model row for its size on every layout, so a page's first layout laid out every row's final document, the rows far above the reader as much as the ones on screen (on a second channel in Toad's Qt client at a phone's speed, 244-289 ms of sizeHint per open, the largest relayouts about 100 ms each). - VirtualRowView.doItemsLayout first measures the rows within MEASURED_VIEWPORTS (2) viewports' height above and below the reader's row (reader_row: the newest at the end, else the row at the viewport's top), then lays out with `estimating()` true. - While estimating, the delegate answers a row it has no size for with an estimate from its plain text's lines (estimated_size, PendingRow's estimate) and queues it. - _measure_slice lays the queued rows out between frames, nearest the reader first, for MEASURE_SLICE_SECONDS (8 ms) at a time, then lays the view out once with rows_changed, which now keeps the end for a reader at it and holds the row under the reader otherwise, so measuring rows above never moves what the reader sees. - measured_size is the one place a row's height is laid out and kept; sizeHint and the slices go through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
This branch has not been deployed
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
A layout of a
VirtualRowViewnow lays out only the rows near the reader. The rest are measured between frames, nearest the reader first, with the reader held in place.QListViewasks every model row for its size on every layout. So a page's first layout laid out every row's final document, the rows far above the reader as much as the ones on screen. In Toad's Qt client at phone speed on the live bus, that was 244–289 ms ofsizeHintper second-channel open, and about 100 ms for the largest single relayout.What changes:
VirtualRowView.doItemsLayout. Before Qt's layout pass, it measures the rows withinMEASURED_VIEWPORTS(2) viewports' height above and below the reader's row. The reader's row (reader_row) is the newest one at the end, else the one at the viewport's top. The pass then runs withestimating()true.estimated_size) and queues it._measure_slicelays the queued rows out between frames, nearest the reader first, 8 ms (MEASURE_SLICE_SECONDS) at a time. Then it lays the view out once throughrows_changed.rows_changednow keeps the end for a reader at it, and otherwise holds the row under the reader. So measuring rows above never moves what the reader sees. A subclass's ownrows_changed(Toad's holds the reader itself) is used as is.measured_sizeis the one place a row's height is laid out and kept.sizeHintand the slices both go through it.This stacks on #63 (base
rows-final-layout-batched).Measured
In Toad's Qt client, on a fixed local bus (150 synthetic messages each on #comms and #scratch, plus a thread). 1 core, unthrottled (
taskset -c 5): the phone-speed throttle needs the host's user systemd manager, which is down. Same Toad tree on both sides, 3 runs each, median.sizeHinttimesizeHintsizeHintThe phone-throttled and live-bus numbers come once the host's user manager and the live bus are back.
Tests
tests/test_virtual_rows_band.py:test_virtual_rows.py, the band tests andtest_log_viewer_lifecycle.py: 18 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3