[KPhotoAlbum] Load-performance branch

Robert Krawitz rlk at alum.mit.edu
Thu Jun 14 00:08:26 BST 2018


On Thu, 14 Jun 2018 00:36:07 +0200, Johannes Zarl-Zierl wrote:
> And another mini-reviewing session ;-)
>
> In void ImageManager::AsyncLoader::requestExit(), why don't you
> simply call wakeAll() instead of calling wakeOne() n times?

Just not familiar enough with Qt, and I copied this code from
elsewhere in kpa.

> Also, it might be worthwhile to simply connect the finished()
> signals of our threads to deleteLater() so that we don't have to
> manually delete them.

I'll take a look at this.  However, I must admit I don't entirely
understand all of the intricacies of QThreads.

> Am Sonntag, 10. Juni 2018, 23:45:27 CEST schrieb Robert Krawitz:
>> > I'm wondering why you start so many transactions in ExifDB, but I haven't
>> > touched that part for a while, so quite possibly I just need to brush up
>> > on my QSqlQuery knowledge a bit...
>> I'm not actaully using more than one transaction (m_insertTransaction)
>> per image scan.  However, in order to simplify the load logic, I need
>> to be able to get at the insert query started within that transaction,
>> hence getInsertQuery.
>
> I was thinking more about stuff like this:
>     m_db.transaction();
>     QSqlQuery *query = getInsertQuery();
>     m_db.transaction();
>
> My thinking is that normally each m_db.transaction() call should
> correspond to a call to either m_db.commit() or m_db.rollback().

This particular case (openInsertQuery) can go away; it's unused.  And
with that, there's exactly one m_db.transaction() (in
startInsertTransaction), one m_db.commit() (in
commitInsertTransaction) and one m_db.rollback (in
abortInsertTransaction).

In order to minimize I/O, I need to hold a transaction open while
DB::NewImageFinder::loadExtraFiles() loads files.  If I load all of
the files first to get their MD5 checksum and build thumbnails, and
then do a batch EXIF load, I have to read at least part of each file
twice, which is expensive.  So unless I want to hoist the EXIF
database code directly into NewImageFinder (which isn't really where
it belongs), the m_db calls are going to be in separate calls.  But
those calls are all made from loadExtraFiles(), so I think it's clean
enough.
-- 
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