mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 09:13:08 -07:00
Preallocate output buffer
This commit is contained in:
parent
d476ae4f14
commit
e7890fb727
1 changed files with 2 additions and 0 deletions
|
@ -2587,6 +2587,7 @@ void Session::saveResumeData()
|
||||||
|
|
||||||
void Session::saveTorrentsQueue()
|
void Session::saveTorrentsQueue()
|
||||||
{
|
{
|
||||||
|
// store hash in textual representation
|
||||||
QMap<int, QString> queue; // Use QMap since it should be ordered by key
|
QMap<int, QString> queue; // Use QMap since it should be ordered by key
|
||||||
for (const TorrentHandle *torrent : asConst(torrents())) {
|
for (const TorrentHandle *torrent : asConst(torrents())) {
|
||||||
// We require actual (non-cached) queue position here!
|
// We require actual (non-cached) queue position here!
|
||||||
|
@ -2596,6 +2597,7 @@ void Session::saveTorrentsQueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
data.reserve(((InfoHash::length() * 2) + 1) * queue.size());
|
||||||
for (const QString &hash : asConst(queue))
|
for (const QString &hash : asConst(queue))
|
||||||
data += (hash.toLatin1() + '\n');
|
data += (hash.toLatin1() + '\n');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue