From 2db7292bcb784622105c810b824e8eb8ca414f2b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 4 Feb 2017 02:57:37 +0100 Subject: [PATCH] Add new setting for the number of preloading worker threads If you have CPU cores to spare, consider setting 2 or 3. Up to about 3 threads, preloading performance seems to increase in a linear fashion, but with 4 or more threads I/O bottlenecks and synchronization overhead starts to show. --- apps/openmw/mwrender/renderingmanager.cpp | 2 +- files/settings-default.cfg | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 5b17bf3b7..1d257a9fc 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -158,7 +158,7 @@ namespace MWRender : mViewer(viewer) , mRootNode(rootNode) , mResourceSystem(resourceSystem) - , mWorkQueue(new SceneUtil::WorkQueue) + , mWorkQueue(new SceneUtil::WorkQueue(Settings::Manager::getInt("preload num threads", "Cells"))) , mUnrefQueue(new SceneUtil::UnrefQueue) , mFogDepth(0.f) , mUnderwaterColor(fallback->getFallbackColour("Water_UnderwaterColor")) diff --git a/files/settings-default.cfg b/files/settings-default.cfg index d9d40bb0b..770a9674d 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -42,6 +42,9 @@ exterior cell load distance = 1 # Preload cells in a background thread. All settings starting with 'preload' have no effect unless this is enabled. preload enabled = true +# The number of threads to be used for preloading operations. +preload num threads = 1 + # Preload adjacent cells when moving close to an exterior cell border. preload exterior grid = true