[KPhotoAlbum] Performance problem with nested categories
Jesper K. Pedersen
blackie at blackie.dk
Sat Dec 9 00:43:20 GMT 2006
Why do you think hasCategoryInfo is expensive? It looks up an item in a map
O(logn) plus afterwards look another item up in a set (another map to be
technical), which is another O(logn).
Cheers
jesper.
On Friday 08 December 2006 23:20, Robert L Krawitz wrote:
| 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.
--
Having trouble finding a given image in your collection containing
thousands of images?
http://www.kphotoalbum.org might be the answer.
More information about the Kphotoalbum
mailing list