<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8059" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Otherwise, it's interesting to see that QFSWatcher takes so much more CPU time, this should really be profiled and fixed upstream.</pre></div></blockquote>

<p>That's assuming the KDirWatch wrapper doesn't introduce a lot of additional overhead when using the QFSW backend. But even so, this would make sense if QFSW doesn't use highly optimised kernel features for watching files.</p>

<p>Also, when I compare the results of a recursive KDirWatch::addDir that adds dirs and files with my optimised implementation that watches only directories, the difference is negligible with the iNotify backend. I don't know that SDK, but one explanation would be that it handles individual file monitoring via a shared monitor on the enclosing directory.</p>

<p>I did introduce a small inaccuracy in the commit message: the test gcc source tree is not on a HDD but on an SSD (mounted over USB3 and Thunderbolt). The results loading the project from the internal HDD are worse:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">> time abstractfilemanagerpluginimportbenchmark gcc-7.2.0
KDirWatch backend: QFSWatch
Starting import of project gcc-7.2.0
        creating dirwatcher took 115.008 seconds
importing project 0 took 3.793 seconds
Done in 118.802 seconds total
105.242 user_cpu 12.118 kernel_cpu 2:01.32 total_time 96.7%CPU</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8059" rel="noreferrer">https://phabricator.kde.org/D8059</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, mwolff<br /><strong>Cc: </strong>mwolff, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger<br /></div>