[KPhotoAlbum] Startup performance: the final frontier

Robert Krawitz rlk at alum.mit.edu
Thu Jun 1 01:32:22 BST 2017

On Tue, 30 May 2017 22:22:11 -0400 (EDT), Robert Krawitz wrote:
> The last big performance problem I have with kpa is startup.  It takes
> about 18 seconds to start up, with the 220K photos in my database.
> I intend to kcachegrind this one of these days.  It's a somewhat
> painful experience, given how long it takes to start that way.  At
> least from the splash screen, it looks like maybe 80% of the time is
> spent in loading the database, the remainder in creating the main
> window (whatever that really means).
> Saving is also problematic, and autosave is very annoying, but not as
> bad as startup.
> I know there was a move afoot a while back to have an SQL database
> rather than an XML file (and XML's pretty unwieldly for this), but
> IIRC nobody ever got it working and eventually it was pulled out.

So, a little research shows me kpa isn't parsing the config file in
the most efficient way:

It's using QDomDocument, which reads the entire file in.  That makes
it easy to extract things the way we want, but is less efficient than
using QXmlStreamReader, which is more of a tokenizer that feeds us

It's possible to read the config.xml file quickly; I did so with
xmllint, which took 2 or 3 seconds.  It's something that may be worth
Robert Krawitz                                     <rlk at alum.mit.edu>

***  MIT Engineers   A Proud Tradition   http://mitathletics.com  ***
Member of the League for Programming Freedom  --  http://ProgFree.org
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