KSyCoca, Thread safety, and Cache invalidation

Thomas Lübking thomas.luebking at gmail.com
Fri Jun 26 17:30:01 BST 2015


On Freitag, 26. Juni 2015 18:03:00 CEST, Frank Reininghaus wrote:
> Hi,
>
> 2015-06-21 16:54 GMT+02:00 David Faure:
>> On Friday 19 June 2015 22:00:09 Vishesh Handa wrote:
>>> On Sat, Jun 13, 2015 at 9:26 PM, David Faure wrote: ...
>> 
>> I thought about it again, and there's a much simpler solution.
>> We get rid of dbus notification altogether, and we simply close+reopen the
>> database if its mtime changed. This is how things work for 
>> shared-mime-info
>> (QMimeDatabase) and it's much simpler.
>
> checking the mtime frequently can have a bad effect on the performance
> though if it's done incorrectly. There is a bug report about high CPU
> usage in Dolphin if "sort by type" is used:
>
> https://bugs.kde.org/show_bug.cgi?id=346974
>
> According to the backtrace, the process is busy inside
> QMimeDataBase::mimeTypeForName(QString) doing time-related things

::shouldCheck() operates on a QDateTime object comparism, while currentMSecsSinceEpoch() should be sufficient (and much slimmer) and also it does a time based comparism in measures of *seconds* so it could likely just flag out the current event cycle -or even a monotic period- for expensive system time tests as well.

At least mimeTypeForName(QString) et al. seem totally unsuited for mass operations in its present state.

Cheers,
Thomas




More information about the kde-core-devel mailing list