Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -169,7 +169,12 @@ static QTimer identityPacketTimer; · 168 unmodified lines | ||
| 169 | 169 | static QTimer pingTimer; |
| 170 | 170 | |
| 171 | 171 | 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); | |
| 173 | 178 | |
| 174 | 179 | static const QString SNAPSHOT_EXTENSION = ".jpg"; |
| 175 | 180 | static const QString SVO_EXTENSION = ".svo"; |
| @@ -514,12 +519,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 338 unmodified lines | ||
| 514 | 519 | PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care |
| 515 | 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 | 522 | QThreadPool::globalInstance()->setMaxThreadCount(PROCESSING_THREAD_POOL_SIZE); |
| 524 | 523 | thread()->setPriority(QThread::HighPriority); |
| 525 | 524 | thread()->setObjectName("Main Thread"); |