Skip to content

Reuse list rows safely during scrolling - #122

Open
k-kostin wants to merge 4 commits into
omacom:mainfrom
k-kostin:codex/reuse-list-rows
Open

k-kostin wants to merge 4 commits into
omacom:mainfrom
k-kostin:codex/reuse-list-rows

Conversation

@k-kostin

@k-kostin k-kostin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reuse the list's Qt delegates without carrying one file's interaction state into another. Rebased onto the expandable tree at 905999e.

FolderList: Qt pool → update model roles → reuse
FileRow: release thumbnail/drag assets and input while pooled
         reset tap history; reject stale arrow presses and grab replies
Tests: existing folio_tests.cpp; no additional target

Active drags temporarily use the existing non-reusing policy. Tree roles and general file thumbnails are preserved. No timers or cacheBuffer changes.

Evidence

  • Before: On the expanded 2,320-row tree, a scripted 7,680 px / 2 s scroll used median 120–124 ms GUI CPU. Median per-process p95 frameSwapped interval 20.9–21.1 ms.
    After: 34–40 ms GUI CPU and 16.7 ms p95. 48 measured processes, 8 alternating pairs per 480 px LTR / 960 px LTR / 960 px RTL viewport. NVIDIA OpenGL/default threaded Qt 6.12, private Weston virtual 60 Hz. Whole-process CPU fell from 233–241 to 139–147 ms. Neither version had intervals over 25 ms. These are application-side notifications, not physical display FPS or proof of avoided skipped refreshes.
  • Earlier software results were mixed: unseen tall mixed windows 8.0→6.5 ms, short 5.3→5.8 ms, first end jump 8.7→11.9 ms. These used prior main 480a319; do not claim all workloads/platforms improve.
  • Before: deliberate removal of each of six lifecycle/display protections produces the intended assertion failure.
    After: focused cases 11 passed at 1× and 2×; full existing bin/test: 258 passed / 0 failed / 1 environment-dependent root-trash skip. Tests check picture reuse/pixels, pooled cleanup, tree depth and visible arrows, double-click identity, releases and late grabs.
  • Native Wayland source-scroll/drop/Escape checks pass in LTR/RTL using temporary files and actual FileOps. Unselected-source destruction remains the existing non-reuse cancellation behavior; this change does not pin it.

Merge Danger

Door: Two-way. No stored format changes or new dependency.

Blast Radius: List. Shared FileRow input/drag code also serves columns; the complete suite passes. Per-row pooled/generation/pressed-path state and the in-suite regressions are the maintenance cost. Equal-distance GPU timing is controlled; the benchmark does not establish physical presentation timing or native-wheel performance.

Manual A/B acceptance passed the three scroll/tree scenarios. The subjective impression of quicker scrolling is not a blind measurement.

A separate native Page Down/Page Up replay during live acceptance reproduced an
existing crash in unpatched main (Qt render-thread signal-connection cleanup).
The exact PR binary completed all four 360-key replay runs. The underlying
cause remains incompletely isolated; this PR does not claim to fix that crash.

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issues were found.

Summary

The list now reuses rows while keeping each file’s clicks, thumbnails, and drag data separate.

  • Folder lists reuse rows as files scroll out of view.
  • A file being dragged keeps its original list row.

The earlier thumbnail-test finding is addressed. No new actionable issues found. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Visible row] --> B[Row enters pool]
    B --> C[Clear drag data and thumbnail]
    C --> D[Stop input and discard tap history]
    D --> E[Update file roles]
    E --> F[Reuse row and restore input]
    F --> A
    A --> G[Drag starts]
    G --> H[Pause row reuse]
    H --> I[Drag ends]
    I --> A
Loading

Reviews (2) · Last reviewed commit: "Check thumbnail pixels at display scale ..." · Reviewed by Greptile

Comment thread tests/rowreuse_tests.cpp Resolved
@omarchybot omarchybot added the enhancement New feature or request label Nov 15, 2026
@dhh

dhh commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, and for the careful thinking about what a reused row must forget. The list has changed under it since: it's a tree now (#160), so FileRow carries a depth and an open/closed arrow, and rows show thumbnails for PDFs and other files too (#149), so the conflict is more than textual. To make it mergeable:

  • Rebase onto today's main and check reuse against the tree: an arrow, its depth and a folder opening or closing while rows are pooled and reused.
  • Put the tests in tests/folio_tests.cpp with the rest rather than a new rowreuse_tests target, and keep them to what reuse changes.
  • Answer Greptile's thread: add a picture to the fixtures, check a pooled row lets go of its thumbnail, and that a row reused for another picture, or for a text file, shows the right one.
  • Measure the win against main as a user would feel it (time to settle after a long scroll, or frames dropped while scrolling), since cumulative GUI CPU over 64 jumps is hard to weigh against the extra state each row now keeps.

If the win holds up on the tree with that, it can go in.

@k-kostin
k-kostin force-pushed the codex/reuse-list-rows branch from 98628c2 to 7c2593c Compare November 19, 2026 19:40
@k-kostin

Copy link
Copy Markdown
Contributor Author

Thanks. I rebased the original reuse change onto the current tree and moved the tests into tests/folio_tests.cpp. They cover the reused arrow and indentation, expansion/collapse while rows are pooled, picture → another picture → text, and interrupted clicks and drags. The full suite passes: 258 passed, 0 failed, 1 environmental skip. The focused cases also pass at 100% and 200% scaling, and native Wayland drop/Escape checks pass in LTR and RTL.

For the long-scroll measurement, I used an expanded 2,320-row tree with synthetic PNG/text files and the same 7,680-pixel, two-second scroll on both versions. Across three viewport configurations, median GUI CPU fell from 120–124 ms to 34–40 ms, and the median per-run p95 interval between Qt frame-swap notifications fell from 20.9–21.1 ms to 16.7 ms. This used NVIDIA OpenGL in a private Weston session with a virtual 60 Hz output, eight alternating pairs per configuration. Neither version had an interval over 25 ms; this measures application-side timing, not physical display FPS.

There is still a tradeoff: earlier software-rendered runs improved tall-list settling from about 8 to 6.5 ms, but the short mixed list went from 5.3 to 5.8 ms, and the first jump to the end from 8.7 to 11.9 ms. I wouldn't claim a win in every scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants