[KPhotoAlbum] Rebuilding thumbnails is not an exercise for the faint of heart

Robert Krawitz rlk at alum.mit.edu
Sun May 20 18:07:01 BST 2018


On Sun, 20 May 2018 18:48:59 +0200, Johannes Zarl-Zierl wrote:
> Am Samstag, 19. Mai 2018, 20:05:14 CEST schrieb Robert Krawitz:
>> >  - generate thumbnails for a list of image files or a directory
>> 
>> What would this use case be?
>
> You can generate thumbnails from a cron-job or from an import
> script. In an NFS setting, you could possibly do that even on the
> server, where running a gui program is usually not much of an
> option.

Got it, although with the current Load-Performance branch there's
little or no penalty for buliding thumbnails at image load time.
There might be some overhead from the repeated file opens on NFS, but
I don't expect any significant bulk I/O transfer since the getattr()
shoud show no change.

As for import script, what I'd rather see in kpa is something that can
do the import and return filenames to kpa as it imports each file and
places it in the filesystem.  That would allow further overlapping of
I/O while allowing the user to use an arbitrary import script.

This would require rewriting NewImageFinder::searchForNewFiles to be
an iterator rather than returning a list of files, with a minor change
in loadExtraFiles().  searchForNewFiles() would be a virtual function,
and subclasses would provide their own implementations.  Most likely
there would be implementations for search filesystem (as present),
script-based import, and gphoto-based import.

It needs to be done in this way rather than import-and-batch-load to
take advantage of the I/O cache; otherwise, a large import would get
kicked out of memory just in time for the files to be needed again.

When I'm importing 5000 files from a doubleheader, optimizations like
these are important.
-- 
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