fix: viewer performance for large directories (#46) #52

Merged
ValleyGeek merged 3 commits from 0.1.21/issue-46-viewer-perf into main 2026-06-12 06:25:11 +00:00
Member

Summary

Fixes #46 — Image Viewer was very slow with directories over 1,000 images (~3s delay opening the viewer and on each A/D navigation).

Root cause

  1. In-viewer navigation: _refresh_filmstrip() decoded thumbnails for every image in the filtered session on each navigation, even though the filmstrip only paints a small visible window.
  2. Return to grid: _restore_from_viewer_sub() ran full _activate_workbench() re-activation, re-applying unchanged filter state and triggering multiple full proxy invalidations over the entire grid.

Fix

  • Lazy filmstrip session: bind per-index resolvers once; navigation updates only the active index; thumbnails resolve at paint time for visible slots.
  • Fast-path viewer exit: lightweight _exit_viewer_to_workbench() swaps the stack widget back without redundant workbench churn; single filter invalidation for tag changes made in the viewer.
  • Filter proxy batching: setters no-op when unchanged; begin_batch_update / end_batch_update coalesce invalidations during workbench activation.
  • Memory: clear_session_resources() releases viewer display caches on exit.

Testing

  • Added regression tests for filmstrip lazy loading, filter batching/no-op guards, single invalidate on viewer restore, and display cache clearing.
  • Full pytest suite: 282 passed, 1 skipped.

Release

Bumps VERSION to 0.1.22.

## Summary Fixes #46 — Image Viewer was very slow with directories over 1,000 images (~3s delay opening the viewer and on each A/D navigation). ## Root cause 1. **In-viewer navigation:** `_refresh_filmstrip()` decoded thumbnails for every image in the filtered session on each navigation, even though the filmstrip only paints a small visible window. 2. **Return to grid:** `_restore_from_viewer_sub()` ran full `_activate_workbench()` re-activation, re-applying unchanged filter state and triggering multiple full proxy invalidations over the entire grid. ## Fix - **Lazy filmstrip session:** bind per-index resolvers once; navigation updates only the active index; thumbnails resolve at paint time for visible slots. - **Fast-path viewer exit:** lightweight `_exit_viewer_to_workbench()` swaps the stack widget back without redundant workbench churn; single filter invalidation for tag changes made in the viewer. - **Filter proxy batching:** setters no-op when unchanged; `begin_batch_update` / `end_batch_update` coalesce invalidations during workbench activation. - **Memory:** `clear_session_resources()` releases viewer display caches on exit. ## Testing - Added regression tests for filmstrip lazy loading, filter batching/no-op guards, single invalidate on viewer restore, and display cache clearing. - Full pytest suite: 282 passed, 1 skipped. ## Release Bumps `VERSION` to **0.1.22**.
The filmstrip rebuilt thumbnails for every image in the filtered session
on each navigation, causing multi-second delays with 1k+ images. Bind a
lazy per-index session once and update only the active index on navigate;
the canvas resolves thumbnails for the visible window at paint time.
perf: fast-path viewer exit and batch filter invalidations (#46)
Some checks failed
CI / test (pull_request) Has been cancelled
CI / nuitka-smoke (pull_request) Has been cancelled
CI / lint (pull_request) Has been cancelled
80370e4144
Returning from the viewer no longer runs full workbench re-activation or
re-applies unchanged filter state six times over large sessions. Filter
proxy setters skip no-op updates and support batched invalidation; viewer
display caches are released on exit.
docs: PR-prep for issue 46 viewer performance fix
All checks were successful
CI / lint (pull_request) Successful in 6s
CI / test (pull_request) Successful in 1m51s
CI / nuitka-smoke (pull_request) Successful in 11m0s
3d2f229b95
Bump release version to 0.1.22, document the viewer responsiveness fix
in CHANGELOG and USER_GUIDE.
ValleyGeek deleted branch 0.1.21/issue-46-viewer-perf 2026-06-12 06:25:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ai-collab/bulk-image-organizer!52
No description provided.