Skip to content

Precompile QML with qmlcachegen, cancel thumbnail helpers, and stream folder counts - #219

Merged
dhh merged 2 commits into
mainfrom
perf-qmlcache-thumbs-counts
Nov 23, 2026
Merged

dhh merged 2 commits into
mainfrom
perf-qmlcache-thumbs-counts

Conversation

@dhh

@dhh dhh commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Ahead-of-time QML compilation (qmlcachegen): Compile Folio's QML and JS into folio_core via qt_add_qml_module(folio_core URI FolioUI ...), leaving optional PdfPreview.qml and MediaPreview.qml as uncompiled resources so builds without qt6-webengine still succeed, and initialize qmlcache_folio_core from Windows and Previewer.
  • Dedicated thumbnail cache pool + running-helper cancellation: Serve disk-cached thumbnails (<size>/...), cached/ previews, and warm sharp/ previews on a dedicated 2-thread cache pool so ready thumbnails never block behind running video/PDF/RAW generators. Poll cancellation in 50 ms slices inside external helper runs (runThumbnailer / pdftoppm), kill the helper's process group immediately when cancelled, and never record failure markers for cancelled work.
  • Progressive 2-pass subfolder counting + batched initial search: Stream counts for ordinary folders (<= 1024 entries) in batches first so one huge folder (e.g. node_modules) never holds back sibling counts, then finish and emit large folders individually. Batch-insert the initial search chunk in FolderModel::insertFound().

Benchmarks

Measured on Arch Linux (Qt 6.12, Release build, offscreen platform):

Benchmark Before (v0.7.2) After Improvement
Cold Windows() QML compile (empty cache) 41.2 ms 23.4 ms −43%
Cold PreviewWindow.qml compile (empty cache) 5.0 ms 0.99 ms 5.1× faster
Cold startup total (empty cache) 86.2 ms 59.6 ms −31%
Cached PNG thumbnail while generators busy 1,405.2 ms 1.08 ms 1,300× faster
Fast thumbnail after cancelling busy helpers ~1,400 ms 2.85 ms ~490× faster
countFolders() — first batch & 30 small siblings (with two 60k-file folders ahead) 21.98 ms 0.78 ms 28× faster

- Precompile QML and JS into folio_core with qmlcachegen via qt_add_qml_module,
  keeping optional PdfPreview/MediaPreview as uncompiled resources and
  initializing qmlcache_folio_core in Windows and Previewer.
- Run fast disk-cache thumbnail probes on a dedicated 2-thread cache pool so
  ready thumbnails and cached previews never stall behind busy generators, and
  kill in-flight thumbnailer/pdftoppm process groups when requests are
  cancelled (without writing bogus failure markers).
- Count subfolders in two streaming passes (<=1024 entries first in batches,
  then large folders) so one huge directory never blocks sibling counts, and
  batch-insert the initial search result chunk.
@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous failed-launch delay is fixed.

Summary

This PR precompiles QML, separates cached thumbnail reads from generation, cancels running helpers, and streams folder counts.

  • Ready thumbnails load separately while cancelled helpers stop running.
  • Small folder counts appear while large folders are still being counted.
  • Folio loads its regular QML views from compiled resources.
  • The first batch of search results enters the model together.

Reviews (2) · Last reviewed commit: "Return immediately when a thumbnail help..." · Reviewed by Greptile

Comment thread src/thumbnails.cpp Resolved
@dhh
dhh merged commit 4fefae9 into main Nov 23, 2026
2 checks passed
@dhh
dhh deleted the perf-qmlcache-thumbs-counts branch November 23, 2026 15:38
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