bruns added a comment.
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. 2. 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`. REPOSITORY R241 KIO REVISION DETAIL https://phabricator.kde.org/D15426 To: fvogt, #frameworks, elvisangelaccio Cc: bruns, kde-frameworks-devel, michaelh, ngraham