diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-04-23 08:54:54 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2020-04-24 11:41:09 +0000 |
commit | 36ef85341aacd225839d58880d3f388f31e3100c (patch) | |
tree | 514cd4f71b40320185b4a77d0769ee945f18c7d6 | |
parent | bffb0650bc1ecea9c0a24d5c47a5adbccaada27a (diff) |
Reduce CommandBuilding/Update job spawning threshold
Those jobs are usually the most expensive to run. It therefore makes
sense we leverage parallelism as much as possible and not discard
threads we could be using.
In that sense, the minimum amount of elements to process per job is reduced
from 100 to 10 which means that we will spawn threads if they can contain
at least 10 element to process (instead of 100 previously).
This now allows to benefit from more parallelism on smaller scenes (that have
less than 100 entities) while still scaling similarly as previously on
larger scenes.
Change-Id: I91e97fc23185d02c2727d87bb7a4ea4991f5ff14
Reviewed-by: Mike Krus <mike.krus@kdab.com>
(cherry picked from commit 37735f11f9437b916b194cfd48c452c7c70682f8)
-rw-r--r-- | src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp b/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp index 0667c21d3..823937f37 100644 --- a/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp +++ b/src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp @@ -89,7 +89,7 @@ public: // Split among the ideal number of command builders const int jobCount = m_renderViewCommandBuilderJobs.size(); - const int idealPacketSize = std::min(std::max(100, entities.size() / jobCount), entities.size()); + const int idealPacketSize = std::min(std::max(10, entities.size() / jobCount), entities.size()); // Try to split work into an ideal number of workers const int m = findIdealNumberOfWorkers(entities.size(), idealPacketSize, jobCount); @@ -348,9 +348,9 @@ public: } // Split among the number of command builders - // The idealPacketSize is at least 100 entities per worker - const int idealPacketSize = std::min(std::max(100, filteredCommandData->size() / RenderViewBuilder::defaultJobCount()), filteredCommandData->size()); - const int m = findIdealNumberOfWorkers(filteredCommandData->size(), idealPacketSize, m_renderViewCommandUpdaterJobs.size()); + const int jobCount = m_renderViewCommandUpdaterJobs.size(); + const int idealPacketSize = std::min(std::max(10, filteredCommandData->size() / jobCount), filteredCommandData->size()); + const int m = findIdealNumberOfWorkers(filteredCommandData->size(), idealPacketSize, jobCount); for (int i = 0; i < m; ++i) { const RenderViewCommandUpdaterJobPtr renderViewCommandBuilder = m_renderViewCommandUpdaterJobs.at(i); |