D15426: Avoid QByteArray::remove in AccessManagerReply::readData

Stefan BrĂ¼ns noreply at phabricator.kde.org
Tue Sep 11 19:47:38 BST 2018


bruns added inline comments.

INLINE COMMENTS

> accessmanagerreply_p.cpp:156
>  
> -    if (length) {
> -        memcpy(data, m_data.constData(), length);
> -        m_data.remove(0, length);
> +    // Remove the stale data before m_offset only if it grows to half
> +    // of the total size, to avoid calling the expensive .remove function.

Wouldn't it be better to trim the buffer in slotData, at least in the non-trivial case?

> accessmanagerreply_p.h:99
>      QByteArray m_data;
> +    qint64 m_offset;
>      bool m_metaDataRead;

You could use in-class initialization here ...

REPOSITORY
  R241 KIO

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

To: fvogt, #frameworks, elvisangelaccio
Cc: bruns, kde-frameworks-devel, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180911/6c073561/attachment.html>


More information about the Kde-frameworks-devel mailing list