bump the minimum number of hash jobs per thread from 2 to 4

This commit is contained in:
arvidn 2018-07-01 22:41:48 +02:00 committed by Arvid Norberg
parent 1c86e94de6
commit b5cd959dd1
2 changed files with 4 additions and 3 deletions

View File

@ -308,7 +308,8 @@ namespace libtorrent
int piece_counter = 0; int piece_counter = 0;
int completed_piece = 0; int completed_piece = 0;
int piece_read_ahead = 16 * 1024 * 1024 / t.piece_length(); int piece_read_ahead = 16 * 1024 * 1024 / t.piece_length();
if (piece_read_ahead < 6) piece_read_ahead = 6; // at least 4 jobs at a time per thread
if (piece_read_ahead < 12) piece_read_ahead = 12;
for (int i = 0; i < piece_read_ahead; ++i) for (int i = 0; i < piece_read_ahead; ++i)
{ {

View File

@ -2764,9 +2764,9 @@ namespace {
int num_outstanding = settings().get_int(settings_pack::checking_mem_usage) * block_size() int num_outstanding = settings().get_int(settings_pack::checking_mem_usage) * block_size()
/ m_torrent_file->piece_length(); / m_torrent_file->piece_length();
// if we only keep a single read operation in-flight at a time, we suffer // if we only keep a single read operation in-flight at a time, we suffer
// significant performance degradation. Always keep at least two jobs // significant performance degradation. Always keep at least 4 jobs
// outstanding per hasher thread // outstanding per hasher thread
int const min_outstanding = 2 int const min_outstanding = 4
* std::max(1, settings().get_int(settings_pack::aio_threads) * std::max(1, settings().get_int(settings_pack::aio_threads)
/ disk_io_thread::hasher_thread_divisor); / disk_io_thread::hasher_thread_divisor);
if (num_outstanding < min_outstanding) num_outstanding = min_outstanding; if (num_outstanding < min_outstanding) num_outstanding = min_outstanding;