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
169169 static QTimer pingTimer;
170170
171171 static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
172−static 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.
175+static const int MIN_PROCESSING_THREAD_POOL_SIZE = 2;
176+static const int PROCESSING_THREAD_POOL_SIZE = std::max(MIN_PROCESSING_THREAD_POOL_SIZE,
177+ QThread::idealThreadCount() - 2);
173178
174179 static const QString SNAPSHOT_EXTENSION = ".jpg";
175180 static const QString SVO_EXTENSION = ".svo";
@@ -514,12 +519,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 338 unmodified lines
514519 PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care
515520 PluginManager::getInstance()->setContainer(pluginContainer);
516521
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)
523522 QThreadPool::globalInstance()->setMaxThreadCount(PROCESSING_THREAD_POOL_SIZE);
524523 thread()->setPriority(QThread::HighPriority);
525524 thread()->setObjectName("Main Thread");