[KPhotoAlbum] Performance problem with nested categories

Robert L Krawitz rlk at alum.mit.edu
Fri Dec 8 23:20:32 CET 2006


I have a database with about 17000 photos in it.

If I select the folder "20d" (which has subfolders such as dcim,
dcim/100canon, etc.), it takes a very long time -- maybe 30 seconds or
thereabouts.  Selecting a leaf folder is very quick.

I put some trace code in.  It looks like the implementation of
DB::OptionValueMatcher::eval() and its children (in particular,
ImageInfo::hasCategoryInfo) is very slow.  The trace I got looks
something like this:

kphotoalbum: eval /home/rlk/images/dcim/144canon/crw_4425.crw Folder 20d
kphotoalbum:    hasCategoryInfo Folder 20d/dcim
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/100canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/101canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/102canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/103canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/104canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/105canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/106canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/107canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/108canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/109canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/110canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/111canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/112canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/113canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/114canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/115canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/116canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/117canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/118canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/119canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/120canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/121canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/122canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/123canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/124canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/125canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/126canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/127canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/128canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/129canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/130canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/131canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/132canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/133canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/134canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/135canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/136canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/137canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/138canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/139canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/140canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/141canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/142canon
kphotoalbum:    hasCategoryInfo Folder 20d
kphotoalbum: eval /home/rlk/images/dcim/144canon/crw_4426.crw Folder 20d
kphotoalbum:    hasCategoryInfo Folder 20d/dcim
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/100canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/101canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/102canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/103canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/104canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/105canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/106canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/107canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/108canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/109canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/110canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/111canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/112canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/113canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/114canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/115canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/116canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/117canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/118canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/119canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/120canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/121canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/122canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/123canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/124canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/125canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/126canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/127canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/128canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/129canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/130canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/131canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/132canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/133canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/134canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/135canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/136canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/137canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/138canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/139canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/140canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/141canon
kphotoalbum:    hasCategoryInfo Folder 20d/dcim/142canon
kphotoalbum:    hasCategoryInfo Folder 20d

The implementation of hasCategoryInfo() itself looks like it might be
somewhat expensive:

    return _categoryInfomation[key].contains(value);

I'm not entirely sure what's going on inside
OptionValueMatcher::eval().  The trace looks very strange.

-- 
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