Increase jobpool thread count based on hardware concurrency

The client/server jobpools were previously only using a fixed number of 2 threads. Now the pools use `2 * hardware-concurrency + 2` threads, which should provide better performance overall, as we expect threads to often wait on I/O.
This commit is contained in:
Robert Müller 2023-10-15 20:56:02 +02:00
parent 2dcec6496f
commit ba5a974353
2 changed files with 2 additions and 2 deletions

View file

@ -4612,7 +4612,7 @@ int main(int argc, const char **argv)
});
// create the components
IEngine *pEngine = CreateEngine(GAME_NAME, pFutureConsoleLogger, 2);
IEngine *pEngine = CreateEngine(GAME_NAME, pFutureConsoleLogger, 2 * std::thread::hardware_concurrency() + 2);
IConsole *pConsole = CreateConsole(CFGFLAG_CLIENT).release();
IStorage *pStorage = CreateStorage(IStorage::STORAGETYPE_CLIENT, argc, (const char **)argv);
IConfigManager *pConfigManager = CreateConfigManager();

View file

@ -112,7 +112,7 @@ int main(int argc, const char **argv)
IKernel *pKernel = IKernel::Create();
// create the components
IEngine *pEngine = CreateEngine(GAME_NAME, pFutureConsoleLogger, 2);
IEngine *pEngine = CreateEngine(GAME_NAME, pFutureConsoleLogger, 2 * std::thread::hardware_concurrency() + 2);
IEngineMap *pEngineMap = CreateEngineMap();
IGameServer *pGameServer = CreateGameServer();
IConsole *pConsole = CreateConsole(CFGFLAG_SERVER | CFGFLAG_ECON).release();