[Bug]: Duplicate-set switching is 1–2s on large workspaces despite neighbor image cache #182
Labels
No labels
Kind/Bug
Kind/Feature
Priority/High
Priority/Medium
Reviewed/Confirmed
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ai-collab/bulk-image-organizer#182
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Affected area
Duplicates workbench — switching the active duplicate set for review (Multi comparison, Single viewer, W/S next/prev, toolbox list click). Neighbor image preload (
DupeMultiGrid.preload_group/_image_cache) is supposed to make adjacent-set changes near-instant.Report
On a large workspace (~9,000+ images, ~600+ duplicate sets), changing from one duplicate set to the next is delayed 1–2 seconds. Adjacent-group image caching exists specifically so this navigation is near-instant; at this scale it is not.
This is the same user-visible failure as closed issue #118 (
[Bug]: Slow Dupe Group Change), which was fixed for hundreds of images. Changelog 0.2.1 recorded that group switching became “near-instant … even in directories with hundreds of images.” Issue #138 later cut Dupe Grid reload/select cost at ~2,200 images / ~270 groups. The 9k / 600+ case still hits a 1–2s pause per set change.Steps to reproduce
F-DUPE_*/V-DUPE_*).Expected
Actual
Code notes (investigation, not a measured profile)
Every set change still runs main-thread work that the image cache does not skip:
_apply_dupe_group_filter→ImageFilterProxy.set_dupe_group_filter→invalidateFilter()walks all ~9,000 source rows (filterAcceptsRow). #118 stopped the extra full sort; the filter pass is still O(workspace)._refresh_tag_filter_views(..., refresh_dupe_list=False)still calls_refresh_dupe_workbench_from_filter, which re-queriesget_dupe_tag_summaries()(aggregate over all dupe memberships) on each navigation._refresh_dupe_multi_viewalways doesget_all_tags()+get_image_dicts_for_dupe_tagfor the current set, then_preload_adjacent_dupe_groupsdoes two moreget_image_dicts_for_dupe_tagcalls. EachWorkingDBcall opens a new connection. The QImage cache is only consulted after that, insideset_group→_rebuild_grid.DupeMultiGrid.set_groupalways_rebuild_grid(): detach pooled cells, destroy row wrappers, recompute tight layout, reparent cells,QImage.copy()+set_source_image(full-res pixmap on the UI thread). Cell pooling and_image_cacheavoid re-decode and widget construction, not this layout/paint work.Related: #118 (closed), #138 (Dupe Grid batching / skip invisible Multi refresh).
Suggested fix direction
Profile first (confirm which of the above dominates at 9k/600). Likely direction:
get_dupe_tag_summaries/get_all_tags/get_image_dicts_for_dupe_tagwhen the destination set (and its neighbors) are already known and image-cached.set_group: if the new group's images are in_image_cacheand the cell count/layout key is unchanged, swap pixmaps/metadata without tearing down row widgets.Threading: workers may decode
QImages and emit them; widgets/pixmaps/layout stay on the main thread.Acceptance criteria
Implemented on branch
0.9.1/issue-182-dupe-set-switch(VERSION0.9.1-bug.182).Adjacent duplicate-set review (W/S, toolbox list, next/prev) no longer does the work that made neighbor caching useless at ~9k images / ~600 groups:
ensure_filter_applied).get_dupe_tag_summaries()is not re-run on a mere set change.get_image_dicts_for_dupe_tagsround trip (no thumbnail blobs).mark_dupe_group_reviewedwrite. Keyboard next/prev no longer double-apply viatag_selected.Please try W/S through nearby sets on the 9k/600 workspace. PR to
mainwaits on your go-ahead.Implemented and opened for review in PR #188 (
0.9.3).Adjacent set changes (W/S, toolbox, next/prev) no longer re-filter the full thumbnail model or re-query dupe summaries. Current ±1 membership and Multi pixmap cache are the fast path; Single applies the proxy filter when it reads rows.
Also covered: Single filmstrip ghost after DELETE + Hide Deleted + group switch (unmapped extra slot / 1:1 leftover image).
Closing this issue in favor of the PR.