Just one compression worker thread on emscripten.

This commit is contained in:
Bartosz Taudul 2022-10-02 00:40:43 +02:00
parent d33c7e5508
commit dff45f1dc1
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -1445,9 +1445,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
alignas(64) std::atomic<State> state = Available;
};
#ifdef __EMSCRIPTEN__
const int jobs = 1;
#else
// Leave one thread for file reader, second thread for dispatch (this thread)
// Minimum 2 threads to have at least two buffers (one in use, second one filling up)
const auto jobs = std::max<int>( std::thread::hardware_concurrency() - 2, 2 );
#endif
auto td = std::make_unique<TaskDispatch>( jobs );
auto data = std::make_unique<JobData[]>( jobs );