History

Update target number of processing threads to be based on system

Ryan Huffman committed 10 years ago

Commit fcd59ea1 parent 489d2e41 file · +6 −7Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+6−7
@@ -169,7 +169,12 @@ static QTimer identityPacketTimer; · 168 unmodified lines
169static QTimer pingTimer;169static QTimer pingTimer;
170 170
171static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;171static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
172static const int PROCESSING_THREAD_POOL_SIZE = 6;172
173// For processing on QThreadPool, target 2 less than the ideal number of threads, leaving
174// 2 logical cores available for time sensitive tasks.
175static const int MIN_PROCESSING_THREAD_POOL_SIZE = 2;
176static const int PROCESSING_THREAD_POOL_SIZE = std::max(MIN_PROCESSING_THREAD_POOL_SIZE,
177 QThread::idealThreadCount() - 2);
173 178
174static const QString SNAPSHOT_EXTENSION = ".jpg";179static const QString SNAPSHOT_EXTENSION = ".jpg";
175static const QString SVO_EXTENSION = ".svo";180static const QString SVO_EXTENSION = ".svo";
@@ -514,12 +519,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 338 unmodified lines
514 PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care519 PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care
515 PluginManager::getInstance()->setContainer(pluginContainer);520 PluginManager::getInstance()->setContainer(pluginContainer);
516 521
517 // FIXME this may be excessively conservative. On the other hand
518 // maybe I'm used to having an 8-core machine
519 // Perhaps find the ideal thread count and subtract 2 or 3
520 // (main thread, present thread, random OS load)
521 // More threads == faster concurrent loads, but also more concurrent
522 // load on the GPU until we can serialize GPU transfers (off the main thread)
523 QThreadPool::globalInstance()->setMaxThreadCount(PROCESSING_THREAD_POOL_SIZE);522 QThreadPool::globalInstance()->setMaxThreadCount(PROCESSING_THREAD_POOL_SIZE);
524 thread()->setPriority(QThread::HighPriority);523 thread()->setPriority(QThread::HighPriority);
525 thread()->setObjectName("Main Thread");524 thread()->setObjectName("Main Thread");