[Kde-pim] Review Request 121306: Use QMutexLocker instead of manual lock/unlock calls.

Milian Wolff mail at milianw.de
Mon Dec 1 11:10:28 GMT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121306/
-----------------------------------------------------------

Review request for Akonadi.


Repository: akonadi


Description
-------

Just a minor cleanup patch, no change of behavior.

Use an QAtomicInt instead of a plain bool for Entity::cacheEnabled.

A plain bool is not thread safe and leads to undefined behavior.
So better be safe than sorry and use a thread safe QAtomicInt.

Optimize: Only do one hash lookup to retrieve value from cache.

Compilers do not merge the call to contains() and the successive
value() lookup. Using iterators thus saves us one QHash lookup.

Optimize: Skip value condition on invalid flags.

HandlerHelper::itemWithFlagsCount gets called quite often apparently
and I noticed that it was relatively slow from the Query Debugger
in Akonadi Console. EXPLAIN'ing the query showed that it was using
a slow-path for the WHERE FOO AND (BAR OR ASDF) condition. Here,
ASDF was always id = -1, the id of the $IGNORED flag, which
I apparently don't have. Getting rid of that condition simplifies
the query to WHERE FOO AND BAR, which is apparently much better
optimizable. Before, the query often showed a runtime of ~15ms.
Now it is down to ~9ms.


Diffs
-----

  server/src/handlerhelper.cpp 634a26c882026bc1f1826f21f27439bfd867cebe 
  server/src/storage/entities-source.xsl 7090c318c5bc3c071d896097e52387de6f311d03 
  server/src/storage/entities.xsl 8b0ed030feda311df16235bf75dd30380381ed34 

Diff: https://git.reviewboard.kde.org/r/121306/diff/


Testing
-------


Thanks,

Milian Wolff

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list