fvogt added a comment.
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. > 1. in `slotData()`, you have to do a copy every time `capacity()` is exceeded. You can piggy-pack on this necessary copy/move, and either do a move if `m_offset >= data.size()` else do a copy of the old data, last append the new `data`. Sure, I added that. Note that it does not actually make a difference for the `readAll()` case as m_offset is always 0 in `slotData`. REPOSITORY R241 KIO REVISION DETAIL https://phabricator.kde.org/D15426 To: fvogt, #frameworks, elvisangelaccio Cc: ngraham, bruns, kde-frameworks-devel, michaelh