D10380: Refactor KCoreDirLister(Cache) to use KFileItemListV2 where possible.

David Faure noreply at phabricator.kde.org
Thu Feb 8 07:03:01 UTC 2018


dfaure requested changes to this revision.
dfaure added a comment.
This revision now requires changes to proceed.


  See, I almost asked in the previous commit "are you sure that this is going to be faster?", and this patch answers it. It's not.
  Which is logical, since you are not able to benefit from move semantics anywhere in this patch (so it's just appending to a QList vs appending to a vector -- same performance), while OTOH you have to introduce slow conversion functions from vector to list.
  
  -2, this isn't going to help.
  At most, make that a KF6 TODO that KFileItemList should inherit std::vector (ideally with an #if version check for the kio version, not just a comment, so that we don't forget).

INLINE COMMENTS

> kcoredirlister.cpp:1934
>      // Make list of deleted items (for emitting)
> -    KFileItemList deletedItems;
> +    KFileItemListV2 deletedItems;
>      QHashIterator<QString, KFileItem*> kit(itemsToDelete);

The actual performance fix would be to add deletedItems.reserve(itemsToDelete.size()) here...

> kcoredirlister.cpp:2576
>              it.next();
> -            emit m_parent->itemsAdded(it.key(), it.value());
> -            emit m_parent->newItems(it.value()); // compat
> +            const KFileItemList list = toKFileItemList(it.value());
> +            emit m_parent->itemsAdded(it.key(), list);

right, so this patch in fact makes things slower.

> kcoredirlister.cpp:2594
>      if (tmpRemove) {
> -        emit m_parent->itemsDeleted(*tmpRemove);
> +        emit m_parent->itemsDeleted(toKFileItemList(*tmpRemove));
>          delete tmpRemove;

slower

REPOSITORY
  R241 KIO

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

To: markg, dfaure
Cc: #frameworks, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180208/7bfdc50f/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list