D15426: Avoid QByteArray::remove in AccessManagerReply::readData
Stefan BrĂ¼ns
noreply at phabricator.kde.org
Wed Sep 12 14:37:53 BST 2018
bruns added a comment.
In D15426#324486 <https://phabricator.kde.org/D15426#324486>, @fvogt wrote:
> In D15426#324284 <https://phabricator.kde.org/D15426#324284>, @bruns wrote:
>
> > For the trivial case, do the clear in `readData()`.
> >
> > For the non-trivial case:
> >
> > 1. in `readData()`, no memmoves were ever done. Currently, if you have e.g. 50 kB in m_data, you read 2 * 16 kB, and move the remaining 18 kB to the front. You can instead just read 3 * 16 + 2 kB.
>
>
> It's always a cpu/memory trade off. I prefer KISS to premature optimization.
if you remove the `|| m_offset * 2 >= m_data.length()`, it gets even simpler, and does less work (especially for the readAll() case). The garbage collection is already done in slotData.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D15426
To: fvogt, #frameworks, elvisangelaccio
Cc: ngraham, bruns, kde-frameworks-devel, michaelh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180912/ea204801/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list