Move caching to intialization so that the GetPhysicalCoreCount is not called every time.

This commit is contained in:
sunshineinabox 2023-07-21 18:31:53 -07:00
parent 50f945c18b
commit 83ce40af2e

View file

@ -72,6 +72,8 @@ namespace ARMeilleure.Translation
_ptc = new Ptc(); _ptc = new Ptc();
_physicalCoreCount = SystemInfo.GetPhysicalCoreCount();
Queue = new TranslatorQueue(); Queue = new TranslatorQueue();
JitCache.Initialize(allocator); JitCache.Initialize(allocator);
@ -121,7 +123,6 @@ namespace ARMeilleure.Translation
_ptc.Disable(); _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 // 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 // etc). All threads are normal priority except from the last, which just fills as much of the last core