D9824: Optimize inotify KDirWatch backend: map inotify wd to Entry

Milian Wolff noreply at phabricator.kde.org
Thu Jan 11 15:11:53 UTC 2018


mwolff created this revision.
mwolff added a reviewer: dfaure.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.
mwolff requested review of this revision.

REVISION SUMMARY
  This greatly reduces the on-CPU time of the benchNotifyWatcher.
  The issue was that for every inotify event, the list of all
  entries would be walked which has abysmal performance when
  the map is large. By introducing a direct mapping we greatly
  speed things up.
  
  I actually spotted this issue while profiling KDevelop, which
  sometimes exhibits similar performance issues.
  
  Running the benchmarks with `-perf` we can measure the cycles
  which trasnaltes to on-CPU time, ignoring the off-CPU time
  induced by sleeping and waiting in the tests.
  
  Before:
  RESULT : KDirWatch_UnitTest::benchNotifyWatcher():
  
    306,496,490.1 CPU cycles per iteration (total: 3,064,964,902, iterations: 10)
  
  After:
  RESULT : KDirWatch_UnitTest::benchNotifyWatcher():
  
    219,120,818.3 CPU cycles per iteration (total: 2,191,208,183, iterations: 10)
  
  Note that the other backends could leverage a similar trick to
  speed them up.

REPOSITORY
  R244 KCoreAddons

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

AFFECTED FILES
  src/lib/io/kdirwatch.cpp
  src/lib/io/kdirwatch_p.h

To: mwolff, dfaure
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180111/2ebc7652/attachment.html>


More information about the Kde-frameworks-devel mailing list