[KPhotoAlbum] Very experimental image-grouping patch
Tero Tilus
tero at tilus.net
Wed Nov 28 21:46:00 GMT 2007
2007-11-28 14:21, Paul Fleischer:
> images = loadImagesFromXML();
> foreach img in images {
> if( images->parent() != null ) {
> DB::ImageDB::instance()->info( img->parent() )->addChildImage(
> img->fileName() );
> }
> }
If I've understood correctly 1) the tree is not going to be very deep (or
maybe not nested at all) and there's a fairly good chance that 2) the set of
parents is orders of magnitude smaller than the set of all images and
that 3) a parent has several children on average.
Could mapping be speeded up by parent cache? Something along the
lines of...
images = loadImagesFromXML();
parent_cache = new imageList();
foreach img in images {
if( images->parent() != null ) {
if ( ! parent = parent_cache->get(img->parent()) ) {
parent = DB::ImageDB::instance()->info( img->parent() );
parent_cache->add(parent);
}
parent->addChildImage(img->fileName());
}
}
Of course if my assumptions do not hold the previsous just complicates
things for no good reason. Assumptions 2 and 3 have to hold in order
to this to speed things up.
--
Tero Tilus ## 050 3635 235 ## http://www.tilus.net/koti/tero/
More information about the Kphotoalbum
mailing list