Bug 518839 - Improve performance of album's cache [patch]
Summary: Improve performance of album's cache [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-Engine (other bugs)
Version First Reported In: 9.1.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-04-11 19:29 UTC by Eugene Vert
Modified: 2026-04-12 09:07 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 9.1.0
Sentry Crash Report:


Attachments
Proposed patch (2.42 KB, patch)
2026-04-11 19:29 UTC, Eugene Vert
Details
childCacheIndex.patch (2.78 KB, patch)
2026-04-12 07:46 UTC, Maik Qualmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Vert 2026-04-11 19:29:01 UTC
Created attachment 191455 [details]
Proposed patch

SUMMARY
`Album::rowFromAlbum` is using `m_childCache.indexOf` and it causes a noticeable delay (~1.5s for Captions->Tags to update) when navigating through an album in Thumbnails view with "Show Assigned Tags"/"Tags already assigned" enabled. It's the most noticeable issue, but after the patch most album operations also became a bit snappier.

STEPS TO REPRODUCE
1. Open Captions->Tags sidebar in Thumbnails view
2. Enable "Tags already assigned" in Captions->Tags sidebar
3. Select image
4. Select other image

OBSERVED RESULT
~1.5s delay until Captions->Tags sidebar is updated.

ADDITIONAL INFORMATION
In `Album` class, `m_childCache` is a `QList<Album*>` container. Instead of sequential search (`indexOf`), maybe it's better to use `QHash` for lookup speed while maintaining `QList` ordering.

Proposed patch attached
Comment 1 caulier.gilles 2026-04-12 01:04:48 UTC
how many tags assigned in your collections ?
how many items by album ?
Comment 2 Maik Qualmann 2026-04-12 05:59:26 UTC
Maintaining the index of the children's albums has always been a performance issue. Previously, we would manually go through all the parents' albums and count them; QList provided a huge boost in this regard. We probably lose some speed when removing albums, but this happens far less frequently. I would still like to tweak it slightly.

Maik
Comment 3 Maik Qualmann 2026-04-12 07:46:38 UTC
Created attachment 191465 [details]
childCacheIndex.patch
Comment 4 Eugene Vert 2026-04-12 08:12:20 UTC
Maik,
Thank you for the patch! After applying it, navigation is smooth and the lag is gone.
Comment 5 Maik Qualmann 2026-04-12 09:07:02 UTC
Git commit ec79a49979f46b749cb1ae713f6ba9872ae7d19e by Maik Qualmann.
Committed on 12/04/2026 at 09:05.
Pushed by mqualmann into branch 'master'.

get child index faster based on the idea of Eugene Vert
FIXED-IN: 9.1.0

M  +1    -1    NEWS
M  +25   -20   core/libs/album/engine/album.cpp
M  +1    -1    core/libs/album/engine/album.h

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