From 36ef85341aacd225839d58880d3f388f31e3100c Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 23 Apr 2020 08:54:54 +0200 Subject: 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 (cherry picked from commit 37735f11f9437b916b194cfd48c452c7c70682f8) --- src/plugins/renderers/opengl/renderer/renderviewbuilder.cpp | 8 ++++---- 1 file 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); -- cgit v1.2.3