[KPhotoAlbum] More thumbnail investigations

Robert Krawitz rlk at alum.mit.edu
Sat May 19 01:11:14 CEST 2018


On Fri, 18 May 2018 23:45:31 +0200, Johannes Zarl-Zierl wrote:
> Hi Robert,
>
> Thanks for your detailed analysis (not just this one, but you often
> dig into things quite thoroughly and provide useful information)!

I've got a lot of performance background...

> Am Montag, 14. Mai 2018, 14:41:43 CEST schrieb Robert Krawitz:
>> The best solution would be to generate thumbnails upon image load for
>> images up to a certain size.  That would combine nicely with the MD5
>> code, which can also profit from having the entire file (since the
>> underlying crypto code in Qt only does 16K I/O ops).  We could always
>> postpone the thumbnail generation for really big files (and files that
>> need load methods other than JPEG or thumbnail extraction from RAW) to
>> the end.
>
> My gut feeling is that we do read image files too many times (at
> least 3 times for exif, thumbnails, md5) and without optimizing for
> cache-friendliness.

We do indeed.  We may read them four times; I'm not certain.  I've
actually added a fourth one -- a scout thread (actually, I'm finding
that two scouts work best, but we can tune it) that slurps the data
into RAM, so the other reads are satisfied by buffering (and I've put
in protocol so the scout thread doesn't get too far ahead).  Combining
thumbnail building with everything else helps too.

>> This work may not be entirely trivial, but it could have a pretty big
>> payoff when loading files.
>
> I've shied away from tackling this issue because of the complexity
> of the code it touches.

It's pretty complex code, to be sure, but this is the very first thing
people see (how fast does it read my photos, and how fast can I skim
through the thumbnails?), and if you have a lot of images, it's very
important from a workflow perspective.
-- 
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