WebUI: Improve lookup performance when filtering by tracker

Torrent hashes in tracker list are now kept in sets instead of arrays.
PR #21405.
This commit is contained in:
skomerko 2024-09-30 12:13:45 +02:00 committed by GitHub
parent 449ca96e28
commit d8e24314ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View file

@ -805,8 +805,7 @@ window.addEventListener("DOMContentLoaded", () => {
trackerListItem = { host: host, trackerTorrentMap: new Map() };
trackerList.set(hash, trackerListItem);
}
trackerListItem.trackerTorrentMap.set(tracker, [...torrents]);
trackerListItem.trackerTorrentMap.set(tracker, new Set(torrents));
}
updateTrackers = true;
}

View file

@ -1485,7 +1485,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if (tracker) {
let found = false;
for (const torrents of tracker.trackerTorrentMap.values()) {
if (torrents.includes(row["full_data"].rowId)) {
if (torrents.has(row["full_data"].rowId)) {
found = true;
break;
}