refactor: Make CCheckQueue constructor start worker threads

This commit is contained in:
Hennadii Stepanov
2023-07-07 10:40:13 +01:00
parent d03eaacbcf
commit 9cf89f7a5b
6 changed files with 18 additions and 40 deletions

View File

@@ -37,10 +37,11 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
return true;
}
};
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
// The main thread should be counted to prevent thread oversubscription, and
// to decrease the variance of benchmark results.
queue.StartWorkerThreads(GetNumCores() - 1);
int worker_threads_num{GetNumCores() - 1};
CCheckQueue<PrevectorJob> queue{QUEUE_BATCH_SIZE, worker_threads_num};
// create all the data once, then submit copies in the benchmark.
FastRandomContext insecure_rand(true);