Update num_threads to use the concurrent hint from the stdlib

This commit is contained in:
Christian Mazakas 2023-04-25 12:18:15 -07:00
parent 4c117ab20a
commit a7c15e86fc

View File

@ -21,8 +21,10 @@
#include <mutex>
#include <thread>
#include <vector>
#include <type_traits>
constexpr std::size_t const num_threads = 16;
static std::size_t const num_threads =
std::max(2u, std::thread::hardware_concurrency());
struct transp_hash
{
@ -326,7 +328,7 @@ std::vector<boost::span<T> > split(
template <class T, class F> void thread_runner(std::vector<T>& values, F f)
{
boost::latch latch(num_threads);
boost::latch latch(static_cast<std::ptrdiff_t>(num_threads));
std::vector<std::thread> threads;
auto subslices = split<T>(values, num_threads);