From 83ce40af2e027544725db9ba1f7ce17aa1b2b271 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Fri, 21 Jul 2023 18:31:53 -0700 Subject: [PATCH] Move caching to intialization so that the GetPhysicalCoreCount is not called every time. --- src/ARMeilleure/Translation/Translator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ARMeilleure/Translation/Translator.cs b/src/ARMeilleure/Translation/Translator.cs index 78521fb62..fa3e984cd 100644 --- a/src/ARMeilleure/Translation/Translator.cs +++ b/src/ARMeilleure/Translation/Translator.cs @@ -71,6 +71,8 @@ namespace ARMeilleure.Translation _oldFuncs = new ConcurrentQueue>(); _ptc = new Ptc(); + + _physicalCoreCount = SystemInfo.GetPhysicalCoreCount(); Queue = new TranslatorQueue(); @@ -121,7 +123,6 @@ namespace ARMeilleure.Translation _ptc.Disable(); - _physicalCoreCount = SystemInfo.GetPhysicalCoreCount(); // Simple heuristic, should be user configurable in future. (1 for 4 core/ht or less, 2 for 6 core + ht // etc). All threads are normal priority except from the last, which just fills as much of the last core