[KPhotoAlbum] Performance problem with viewing images

Robert Krawitz rlk at alum.mit.edu
Sat Nov 3 20:49:51 CET 2007


   Date: Sat, 3 Nov 2007 14:17:13 -0400
   From: Robert Krawitz <rlk at alum.mit.edu>

   Some time in the last month or so, viewing large numbers of images
   slowed down.

   If I have, say, 1000 images in the thumbnail viewer and click on one
   of them to view it, it takes about a minute for even the first one to
   pop up.  If I pre-select only a few images, it's reasonably quick.

   Has the preloading mechanism changed recently?

I found the culprit -- revision 720309.  If I remove the setPriority()
call, images load quickly.

Index: Viewer/ImageDisplay.cpp
===================================================================
--- Viewer/ImageDisplay.cpp     (revision 720308)
+++ Viewer/ImageDisplay.cpp     (revision 720309)
@@ -637,6 +637,7 @@
 
     ImageManager::ImageRequest* request = new ImageManager::ImageRequest( info->fileName(), s, info->angle(), this );
     request->setUpScale( viewSize == Settings::FullSize );
+    request->setPriority();
     ImageManager::Manager::instance()->load( request );
 }
 
The problem, I think, is that the viewer wants to preload images.  So
it issues a number of requests very quickly.  The problem is that the
setPriority call simply prepends the request to the list of existing
requests, making it a LIFO queue rather than a FIFO.  The result is
that the first request to be made becomes the last one to be
processed.

A better way to do this would be to have two separate queues, a low
priority and a high priority queue.  A setPriority() call would append
the request to the high priority queue.  If we want a way to really
set an absolute high priority, then have a setImmediate() that
prepends to the high priority queue.

If I set a very small thumbnail size, then if there are a lot of
thumbnail requests on the queue, it does take a long time to load the
desired image, so we do want a priority boost.  This just isn't the
right way to do it.


More information about the KPhotoAlbum mailing list