D7995: KDevelop: address dirwatching inefficiency (WIP/PoC)

René J.V. Bertin noreply at phabricator.kde.org
Tue Sep 26 16:41:06 UTC 2017


rjvbb created this revision.
rjvbb added a reviewer: KDevelop.
rjvbb added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel.

REVISION SUMMARY
  Cf. https://bugs.kde.org/show_bug.cgi?id=384880
  
  This provides a PoC/WIP patch that shows a possible way to improve the current inefficiency in the dirwatching approach. That current approach consists of calling `KDirWatch::addDir(<project source dir>)` with the instruction to add all files and directories recursively.
  
  This happens on the main thread and atomically, thus blocking the event loop for large projects. See D7742 for timing examples, and https://phabricator.kde.org/D7745 for a companion patch that adds temporary code for project import timing.
  
  This patch installs watchers only on directories, and "online" during the import process itself, by `FileManagerListJob`. It still contains a bit of code allowing to turn off dirwatching; please note that this is only to allow evaluating the overhead of this new approach.
  
  There's a mutex acting as a barrier to serialise access to the underlying QFileSystemWatcher object used by KDirWatch (when it uses QFSW); this change can of course be proposed upstream. It seems to be required despite Qt's claim that the class is reentrant. On Mac import times can be longer without it and on Linux I've seen sporadic memory allocation (and freeing) errors without it.

TEST PLAN
  Works as intended: the time overhead of creating and populating a dirwatcher is much smaller - and dirwatching now actually works on Mac.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D7995

AFFECTED FILES
  kdevplatform/interfaces/iprojectcontroller.cpp
  kdevplatform/interfaces/iprojectcontroller.h
  kdevplatform/project/CMakeLists.txt
  kdevplatform/project/abstractfilemanagerplugin.cpp
  kdevplatform/project/abstractfilemanagerplugin.h
  kdevplatform/project/filemanagerlistjob.cpp
  kdevplatform/project/filemanagerlistjob.h
  kdevplatform/shell/settings/projectconfig.kcfg
  kdevplatform/shell/settings/projectpreferences.ui

To: rjvbb, #kdevelop
Cc: kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170926/fcea4b0c/attachment.html>


More information about the KDevelop-devel mailing list