perf: use small:set in tr_file_piece_map::reset() (#5720)

This commit is contained in:
Charles Kerr 2023-07-03 21:57:09 -05:00 committed by GitHub
parent d76d26a580
commit 7c7771a12b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -3,9 +3,10 @@
// or any future license endorsed by Mnemosyne LLC.
// License text can be found in the licenses/ folder.
#include <set>
#include <vector>
#include <small/set.hpp>
#include "libtransmission/transmission.h"
#include "libtransmission/block-info.h"
@ -21,7 +22,8 @@ void tr_file_piece_map::reset(tr_block_info const& block_info, uint64_t const* f
file_pieces_.resize(n_files);
file_pieces_.shrink_to_fit();
auto edge_pieces = std::set<tr_piece_index_t>{};
auto edge_pieces = small::set<tr_piece_index_t, 1024U>{};
edge_pieces.reserve(n_files * 2U);
uint64_t offset = 0;
for (tr_file_index_t i = 0; i < n_files; ++i)