Re: Speeding up annotation

Robert Krawitz <rlk-FrUbXkNCsVf2fBVCVOL8/[email protected]> Sat, 11 Jan 2020 21:43:49 -0500 (EST)
Newsgroups gmane.comp.kde.kimdaba
Message-ID <20200112024349.0619C4249AC@localhost>
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                                     <[email protected]>

***  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
_______________________________________________
KPhotoAlbum mailing list
[email protected]
https://mail.kdab.com/mailman/listinfo/kphotoalbum