Created attachment 164288 [details] profile samples during application slowdown I've been a happy user of Digikam for many years, currently using it from a M3 macOS laptop with a local database and pictures on my NAS (Synology, SMB, 2.5Gbe link). Over the past couple of months though, I had been noticing a gradual slowdown of Digikam during basic file management tasks (moving pictures, creating albums, or even just expanding trees in the UI). After finally being sufficiently annoyed, I decided to profile the application during one of the operations grinding the application to a halt (where it got stuck for 5-10s). The relevant bits, out of a 5s sample: 4273 QTreeView::resizeColumnToContents(int) (in QtWidgets) + 67 [0x110b12903] 4273 QTreeView::sizeHintForColumn(int) const (in QtWidgets) + 637 [0x110b1335b] 4273 QTreeViewPrivate::widthHintForIndex(QModelIndex const&, int, QStyleOptionViewItem const&, int) const (in QtWidgets) + 174 [0x110b0ea9e] 4273 ??? (in libdigikamgui.8.2.0.dylib) load address 0x10a2dc000 + 0x227529 [0x10a503529] 4273 QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const (in QtWidgets) + 106 [0x110ae125a] 4273 QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const (in QtWidgets) + 498 [0x110ae0e42] 4273 ??? (in QtWidgets) load address 0x110925000 + 0xb65af [0x1109db5af] 4273 QSortFilterProxyModel::data(QModelIndex const&, int) const (in QtCore) + 99 [0x111eb34f5] 4273 Digikam::AbstractAlbumModel::data(QModelIndex const&, int) const (in libdigikamgui.8.2.0.dylib) + 397 [0x10a4ea79d] 4273 Digikam::AlbumModel::albumData(Digikam::Album*, int) const (in libdigikamgui.8.2.0.dylib) + 472 [0x10a4f2bb8] 4273 Digikam::AbstractCheckableAlbumModel::albumData(Digikam::Album*, int) const (in libdigikamgui.8.2.0.dylib) + 291 [0x10a4f0903] 4273 Digikam::AbstractCountingAlbumModel::albumData(Digikam::Album*, int) const (in libdigikamgui.8.2.0.dylib) + 614 [0x10a4edd06] 4273 Digikam::AbstractAlbumModel::albumData(Digikam::Album*, int) const (in libdigikamgui.8.2.0.dylib) + 400 [0x10a4ea970] 4273 Digikam::AlbumModel::decorationRoleData(Digikam::Album*) const (in libdigikamgui.8.2.0.dylib) + 72 [0x10a4f2728] 4273 Digikam::AlbumThumbnailLoader::getAlbumThumbnailDirectly(Digikam::PAlbum*) (in libdigikamgui.8.2.0.dylib) + 271 [0x10a51660f] 4273 Digikam::AlbumThumbnailLoader::getStandardAlbumIcon(Digikam::PAlbum*, Digikam::AlbumThumbnailLoader::RelativeSize) (in libdigikamgui.8.2.0.dylib) + 133 [0x10a5144d5] 4273 Digikam::Album::countTrashAlbum() const (in libdigikamgui.8.2.0.dylib) + 411 [0x10a505ceb] 4273 QDir::count() const (in QtCore) + 20 [0x111e5694a] 4273 ??? (in QtCore) load address 0x111d95000 + 0xc19b7 [0x111e569b7] 4273 QDirIterator::next() (in QtCore) + 21 [0x111e5b175] 4261 ??? (in QtCore) load address 0x111d95000 + 0xc58cb [0x111e5a8cb] ! 4260 ??? (in QtCore) load address 0x111d95000 + 0xc5a78 [0x111e5aa78] ! : 4260 ??? (in QtCore) load address 0x111d95000 + 0xc5dd6 [0x111e5add6] ! : 4260 QFileInfo::isHidden() const (in QtCore) + 80 [0x111e5fcf8] ! : 2203 ??? (in QtCore) load address 0x111d95000 + 0xfe5b3 [0x111e935b3] ! : | 2184 ??? (in QtCore) load address 0x111d95000 + 0xff420 [0x111e94420] ! : | + 2184 CFURLCopyResourcePropertyForKey (in CoreFoundation) + 96 [0x7ff8164ce9cd] ! : | + 2181 _FSURLCopyResourcePropertyForKeyInternal(__CFURL const*, __CFString const*, void*, void*, __CFError**, unsigned char) (in CoreServicesInternal) + 266 [0x7ff819883b8b] ! : | + ! 2181 prepareValuesForBitmap(__CFURL const*, __FileCache*, _FilePropertyBitmap*, __CFError**) (in CoreServicesInternal) + 380 [0x7ff819887427] ! : | + ! 2174 corePropertyProviderPrepareValues(__CFURL const*, __FileCache*, __CFString const* const*, void const**, long, void const*, __CFError**) (in CoreServicesInternal) + 932 [0x7ff819887830] ! : | + ! : 2174 __getattrlist (in libsystem_kernel.dylib) + 10 [0x7ff8163e01ce] ! : | + ! : 2174 ??? (in <unknown binary>) [0x7ff8a699ea78] I'll attach a couple of full samples, each 5s long, taken during various operations that made the UI hang. The common factor in each of these is the call to `countTrashAlbum`, and indeed, I did have significant trashes on each of my libraries. Even better, clearing them all out made the application really snappy again! That said, I wouldn't ever have thought about large trashes being the culprit of this slowdown. It's possible that there's compounding factors (the code being transpiled by Rosetta or other macOS inefficiencies, the fact that my libraries are on a NAS, etc), but nonetheless it feels like there's something to optimize here. SOFTWARE/OS VERSIONS Digikam: 8.2.0, installed using homebrew macOS: 14.2, M3 Pro KDE Frameworks Version: 5.110.0 Qt Version: 5.15.11
Thanks, that's an interesting bug report. We count the number of files in the trash at the file level. And this can actually be slow with a large number of files in the trash, depending on the file system. In addition, this function is executed every time the AlbumTreeView is refreshed. Maik
Git commit ce4885eb1666f579aabf8157807f402956b7c365 by Maik Qualmann. Committed on 20/12/2023 at 08:24. Pushed by mqualmann into branch 'master'. until a solution is found, don't show the trash counter M +2 -1 core/libs/album/engine/albumthumbnailloader.cpp M +2 -1 core/libs/models/albummodel.cpp https://invent.kde.org/graphics/digikam/-/commit/ce4885eb1666f579aabf8157807f402956b7c365
Git commit 6e374ce7572996e021c08e2873a1aabbcbb31fa6 by Maik Qualmann. Committed on 20/12/2023 at 23:01. Pushed by mqualmann into branch 'master'. add thread for counting the trash contents After a trash action, the counters in the tree view are only updated when you click in the view. We already have a bug report about this, which will be fixed in a second step. FIXED-IN: 8.3.0 M +1 -1 NEWS M +4 -0 core/app/main/digikamapp.cpp M +2 -21 core/libs/album/engine/album.cpp M +0 -5 core/libs/album/engine/album.h M +9 -4 core/libs/album/engine/albumthumbnailloader.cpp M +1 -0 core/libs/album/treeview/abstractalbumtreeview_p.h M +4 -0 core/libs/album/treeview/albumtreeview.cpp M +45 -0 core/libs/database/utils/ifaces/dio.cpp M +10 -2 core/libs/database/utils/ifaces/dio.h M +34 -0 core/libs/iojobs/iojob.cpp M +24 -0 core/libs/iojobs/iojob.h M +14 -0 core/libs/iojobs/iojobsmanager.cpp M +6 -0 core/libs/iojobs/iojobsmanager.h M +17 -1 core/libs/iojobs/iojobsthread.cpp M +7 -0 core/libs/iojobs/iojobsthread.h M +8 -2 core/libs/models/albummodel.cpp M +1 -0 core/libs/models/albummodel_p.h https://invent.kde.org/graphics/digikam/-/commit/6e374ce7572996e021c08e2873a1aabbcbb31fa6
Git commit 237e43dcc22957dc8cf5189af4ea58232d358819 by Maik Qualmann. Committed on 21/12/2023 at 08:27. Pushed by mqualmann into branch 'master'. update trash counters after changing trash contents Related: bug 476397 FIXED-IN: 8.3.0 M +0 -4 core/libs/album/engine/album.cpp M +0 -4 core/libs/album/treeview/albumtreeview.cpp M +0 -1 core/libs/iojobs/iojob.cpp M +19 -0 core/libs/models/albummodel.cpp M +4 -0 core/libs/models/albummodel.h https://invent.kde.org/graphics/digikam/-/commit/237e43dcc22957dc8cf5189af4ea58232d358819