[KPhotoAlbum] Patch to improve performance of new image scan

Robert L Krawitz rlk at alum.mit.edu
Sun Apr 15 16:29:00 BST 2007


   From: Shawn Willden <shawn-kimdaba at willden.org>
   Date: Sat, 14 Apr 2007 00:55:39 -0600

   On Wednesday 11 April 2007 05:16, Robert L Krawitz wrote:
   > This is a patch I posted a while back to improve performance of the
   > new image scan.  It improves performance by not attempting to stat()
   > files unless we have reason to be interested in them in the first
   > place (the QDir class winds up stat'ing every file in the directory,
   > which is quite expensive since it requires a lot of disk accesses).

   One minor suggestion: It would probably be a good idea to move the
   code that determines if the file is RAW or "standard" to a couple
   of functions in the Utilities class, like the "isVideo()" method.

I thought about that, but RawImageDecoder.cpp already contains
RAWImageDecoder::_mightDecode(), which also checks whether a file can
be decoded.  _skipThisFile() is very similar to _mightDecode(), so it
hought it made more sense to keep them together.  If anything, it
would make more sense to merge them (or at least their
implementations) outright.

   I'd probably also use a StringSet for faster lookups like the
   isVideo() method does, but that probably doesn't matter in this
   case, since runtime will be dominated by I/O.

It's probably worth doing on general principles, but with a 20000
image database, the time spent here is negligible.

-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

Tall Clubs International  --  http://www.tall.org/ or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf at uunet.uu.net
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