Skip to content

virtual rows: bound per-key row metrics and reschedule multi-slice measurement - #76

Merged
trissim merged 1 commit into
mainfrom
toad-qt/row-document-cache
Nov 23, 2026
Merged

trissim merged 1 commit into
mainfrom
toad-qt/row-document-cache

Conversation

@trissim

@trissim trissim commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Consolidates RowDocumentDelegate._size_hints, _extents, and _cached_widths into one LRU-bounded _metrics OrderedDict (evicting metrics/documents with _prepared and bounding direct measured_height keys), and fixes _measure_slice() skipping _measure_timer.start() when remaining unmeasured rows span multiple 8ms slices.

…multi-slice measurement

1. Consolidate RowDocumentDelegate's three parallel per-width dicts
   (_size_hints, _extents, _cached_widths) into one LRU-bounded OrderedDict
   of per-key width->RowMetrics (_metrics, bounded by MAX_PREPARED_ROWS).
   - Evicting an old key from _prepared now also drops its kept metrics and
     documents instead of leaking them forever.
   - Keys measured directly via measured_height without entering _prepared
     (e.g. pinned sub-block measurements) stay LRU-bounded to MAX_PREPARED_ROWS.
   - Expose measured_size_for(key, width) and measured_count() instead of
     probing _size_hints directly.
2. Fix _measure_slice() stopping mid-thread when unmeasured rows span multiple
   8ms slices: `if measured: view.rows_changed()` previously skipped
   `elif self._unmeasured: self._measure_timer.start()`, and because estimated
   rows already hold a kept_row entry, sizeHint() never re-armed the timer.
   Change `elif self._unmeasured:` to `if self._unmeasured:` so multi-slice
   measurement always drains to completion.
@trissim
trissim merged commit a8ef7ef into main Nov 23, 2026
2 of 12 checks passed
@trissim
trissim deleted the toad-qt/row-document-cache branch November 23, 2026 23:36
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