[KPhotoAlbum] More performance tuning

Robert L Krawitz rlk at alum.mit.edu
Sat Feb 11 01:01:58 GMT 2006


There's another spot that I think is ripe for some performance tuning
work: the thumbnail cache.

void ThumbnailView::ThumbnailView::reload( void )
{
    pixmapCache().clear();
    _selectedFiles.clear();
    updateCellSize();
    repaintScreen();
}

This is called out of MainView::reloadThumbnails(), which is called
whenever the thumbnails are shown, the date range changed, images are
reconfigured, and a few other cases.  There certainly are situations
where the entire thumbnail cache needs to be cleared; the thumbnail
size changing is of course one of them.  However, in many
circumstances there's no need for the thumbnail cache to be cleared at
all (e. g. when the date range is changed, when the thumbnails are
displayed), and others where only a few thumbnails need to be flushed
(thumbnails are rotated or drawn on, for example).  Even with my
improvements there's a huge performance difference between redrawing
cached thumbnails and loading the thumbnails to begin with.  I've
prototyped a change whereby the pixmap cache is only cleared in some
cases (where the thumbnail size is changed or where images are
reconfigured) and it's a lot faster.

Another optimization that might be worthwhile would be to have a
background thread that gradually loads thumbnails whenever nothing
else is going on.  For the common case where someone loads a large set
of images and then gradually scrolls down this would make the
application much snappier.

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