[KPhotoAlbum] Speeding up annotation
Robert Krawitz
rlk at alum.mit.edu
Sun Jan 12 02:43:49 GMT 2020
On Sun, 5 Jan 2020 22:33:56 -0500 (EST), Robert Krawitz wrote:
> On Sun, 05 Jan 2020 23:01:13 +0100, Johannes Zarl-Zierl wrote:
>> Am Sonntag, 5. Jänner 2020, 20:23:50 CET schrieb Robert Krawitz:
>>> I found one easy fix in the selection code after the annotations are
>>> changed. It's still very slow and may be worse than linear, but at
>>> least one real problem is cleaned up.
>>
>> Thank you for your work!
>
> AnnotationDialog::Dialog::selectionForMultiSelect() is definitely a
> hot spot. But I'm going to ned to call it a night, I'm afraid...
Yes, this one really is nasty. This is the inner loop, over all
images:
for (DB::ImageInfoList::ConstIterator imageIt = images.begin(); imageIt != images.end(); ++imageIt) {
const StringSet itemsOnThisImage = (*imageIt)->itemsOfCategory(category);
itemsNotSelectedOnAllImages += (allItems - itemsOnThisImage);
itemsOnSomeImages += itemsOnThisImage;
}
This is doing two probably expensive set operations on each image,
both in and out of the annotation dialog. We can surely do this a lot
more quickly...
--
Robert Krawitz <rlk at alum.mit.edu>
*** MIT Engineers A Proud Tradition http://mitathletics.com ***
Member of the League for Programming Freedom -- http://ProgFree.org
Project lead for Gutenprint -- http://gimp-print.sourceforge.net
"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
More information about the Kphotoalbum
mailing list