Bug 508633

Summary: Duplicates freezes, cant sort by Similarity, or resize
Product: [Applications] digikam Reporter: drrugg <drrugg+kde>
Component: Maintenance-SimilaritiesAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.7.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.8.0
Sentry Crash Report:
Attachments: Scanning, getting to 100, and moment pause happens with no UI change

Description drrugg 2025-08-23 08:38:07 UTC
Created attachment 184369 [details]
Scanning, getting to 100, and moment pause happens with no UI change

SUMMARY
* Looking at Similarity > Duplicates file display after searching, you can't resize the two columns 'Items' and 'Simiiliarity'

* Clicking on column Similarity toggles the sort icon, but doesn't do anything. (Marked as patched before, unsure if that means "only in the beta" or "GA released")

* when scanning a fairly new set of folders with overlapping backups - 47k images with 44k duplicates, after processing as a queue at the bottom of the screen and gets to 100%, The ref images updates after a moment, but the program freezes for several minutes.  

During this time. the disk is not in use, the CPU has low usage, and the program only shows a Windows-hourglass as it isn't taking input at all.

After it finishes an internal process, then the program is running fast again - sorting and selecting images is fast.



STEPS TO REPRODUCE
1.  Deleted database, and imported folders relating to overlapping images 44k
2.  Run 'Update thumbprints', and run 'Find Duplicate'.
3. run Find Duplicate again with 'prefer selected album' as option. 

OBSERVED RESULT

Update thumbprints - 35s
Scan for duplicates with default settings - ~1min 50s
Time after hitting 100% before screen refreshes - +9min more
Rescan for duplicates - very little delay from 100% to showing.
Rescan with "Prefer selected album (24)" - 7min
Rescan without changing settings - 7min

EXPECTED RESULT

Either immediate result (like rerunning the second time), OR, activities to be on a second thread so that program doesn't stop responding while something is processed, and some UI indication of what work is going on ("building results")

I can only guess that it is pre-generating all the page results, but it feels strange that the program is literally generating "program not responding" alerts and very little activity in the meantime.

SOFTWARE/OS VERSIONS
Windows:  Win 11 24h2 (latest)


ADDITIONAL INFORMATION
Comment 1 caulier.gilles 2025-08-23 11:27:42 UTC
Which database type did you use ?

Can you run debugview to show application trace while the dysfunction, following instructions here :

https://www.digikam.org/contribute/#windows-host
Comment 2 Maik Qualmann 2025-08-23 14:15:54 UTC
I can confirm the problem: the FindDuplicatesAlbum list view takes too long to build because the creation of a FindDuplicatesAlbumItem is too slow.
Let's see...

Maik
Comment 3 Maik Qualmann 2025-08-23 15:19:39 UTC
optimize FindDuplicatesAlbumItem speed #1
QCollator loads a larger file, and doing this
for each item is slow. Speed gain here is about 30%.

https://invent.kde.org/graphics/digikam/-/commit/ba4e9952da60af5b1c05903dd905fbf3e8c75b98
Comment 4 Maik Qualmann 2025-08-23 17:02:38 UTC
use QtConcurrent::run to calculate infos

https://invent.kde.org/graphics/digikam/-/commit/a824692d3ea7adadd3de09d645404ce4ae4c35eb
Comment 5 Maik Qualmann 2025-08-23 21:36:51 UTC
Git commit ba4e9952da60af5b1c05903dd905fbf3e8c75b98 by Maik Qualmann.
Committed on 23/08/2025 at 14:47.
Pushed by mqualmann into branch 'master'.

optimize FindDuplicatesAlbumItem speed #1
QCollator loads a larger file, and doing this
for each item is slow. Speed gain here is about 30%.

M  +5    -9    core/utilities/fuzzysearch/findduplicatesalbumitem.cpp
M  +0    -1    core/utilities/fuzzysearch/findduplicatesalbumitem.h

https://invent.kde.org/graphics/digikam/-/commit/ba4e9952da60af5b1c05903dd905fbf3e8c75b98
Comment 6 Maik Qualmann 2025-08-23 21:39:00 UTC
Git commit a824692d3ea7adadd3de09d645404ce4ae4c35eb by Maik Qualmann.
Committed on 23/08/2025 at 16:40.
Pushed by mqualmann into branch 'master'.

use QtConcurrent::run to calculate infos
FIXED-IN: 8.8.0

M  +1    -1    NEWS
M  +1    -0    core/utilities/fuzzysearch/CMakeLists.txt
M  +2    -2    core/utilities/fuzzysearch/findduplicatesalbum.cpp
M  +20   -3    core/utilities/fuzzysearch/findduplicatesalbumitem.cpp
M  +4    -0    core/utilities/fuzzysearch/findduplicatesalbumitem.h
M  +1    -1    core/utilities/fuzzysearch/findduplicatesview.cpp

https://invent.kde.org/graphics/digikam/-/commit/a824692d3ea7adadd3de09d645404ce4ae4c35eb