D29562: KDirectoryContentsCounter: Avoid scanning twice the same dir, prioritise path not in cache

Elvis Angelaccio noreply at phabricator.kde.org
Mon May 18 00:14:59 BST 2020


elvisangelaccio added a comment.


  @meven Yes please. The patch may be small, but it's not trivial. Smaller atomic changes are always easier to review.

INLINE COMMENTS

> kdirectorycontentscounter.cpp:186-194
> +        if (!m_priority_queue.contains(path) && !m_queue.contains(path)) {
> +            if (!alreadyInCache) {
> +                // path is not in cache, will treat it first
> +                m_priority_queue.insert(0, path);
> +            } else {
> +                // unprioritized path to visit
> +                m_queue.insert(0, path);

So if I'm not wrong, this is 2*O(n) + another O(n) for the insert. Previously it was just an amortized O(1) insert.

Are we sure we are not slowing down?

REPOSITORY
  R318 Dolphin

BRANCH
  master

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

To: meven, #dolphin, elvisangelaccio, ngraham
Cc: feverfew, kfm-devel, waitquietly, azyx, nikolaik, pberestov, iasensio, aprcela, fprice, fbampaloukas, alexde, Codezela, meven, spoorun, navarromorales, firef, ngraham, andrebarros, emmanuelp, rdieter, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200517/8203413e/attachment.htm>


More information about the kfm-devel mailing list