KSyCoca, Thread safety, and Cache invalidation

Mark Gaiser markg85 at gmail.com
Thu Jul 30 20:23:00 BST 2015


On Tue, Jul 28, 2015 at 4:28 PM, David Faure <faure at kde.org> wrote:

> On Tuesday 14 July 2015 19:28:58 Thomas Lübking wrote:
> > On Dienstag, 14. Juli 2015 19:00:14 CEST, Milian Wolff wrote:
> > > On Tuesday, July 14, 2015 11:49:25 AM David Faure wrote:
> > >> On Friday 26 June 2015 18:03:00 Frank Reininghaus wrote: ...
> > >
> > > It has. Querying the current time repeatedly is quite costly,
> > > and often shows
> > > up in code that extensively uses timers, or
> > > QDateTime::currentDateTime() etc.
> > >
> > > But it's probably still cheaper than querying on-disk meta data
> > > in the worst
> > > case, esp. on old rotary disks.
> >
> > Actually, checking currentTime() is already the problem here (causing
> the IO for the timezone stuff), see
> http://marc.info/?l=kde-core-devel&m=143533622526705&w=1 (the 1st
> paragraph part of my comment somehow turned into a second-level quote)
> >
> > Comparing a monotic timer (QElapsedTime) is however - at least on linux
> - close to cost free PLUS: one can have an entirely free "do not check
> again during this event cycle" flag.
>
> I used QElapsedTimer in https://codereview.qt-project.org/122247
> and the resulting performance improvements are amazing.
> kbuildsycoca5 is twice faster.


Ohh, interesting! You're optimizing stuff :D

I just ran "kbuildsycoca5 --noincremental" through kcachegrind without your
patch to Qt and i do see one other quite big hot spot you might be
interested in.
In my case the profile collected 1.147.572.920 instructions. Nearly half of
all those instructions (516.700.823) are spend in QMimeType::inherits. The
cost per QMimeType::inherits call is 52.692 instructions (it's being called
9806 times). That function is heavy! I don't know exactly what it's doing
since Qt is build in release mode without debug symbols (system package) so
i only see lots of cycles being spend there, not what they are doing.

You can ignore this message if QMimeType::inherits internally calls the
method you optimized thus this function would be greatly improved already.
Internally it's calling this function:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/mimetypes/qmimedatabase.cpp#n216
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20150730/43c416c1/attachment.htm>


More information about the kde-core-devel mailing list