Reserve memory for file data buffers

This commit is contained in:
Chocobo1 2019-10-27 21:37:23 +08:00
parent c73d698718
commit e262b86c44
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
2 changed files with 8 additions and 3 deletions

View file

@ -3507,6 +3507,7 @@ void Session::handleTorrentResumeDataReady(TorrentHandle *const torrent, const l
// isn't cheap too.
QByteArray out;
out.reserve(1024 * 1024); // most fastresume file sizes are under 1 MB
lt::bencode(std::back_inserter(out), data);
const QString filename = QString("%1.fastresume").arg(torrent->hash());