diff --git a/CompilePalX/Compilers/CompileExecutable.cs b/CompilePalX/Compilers/CompileExecutable.cs index 2d80bbf6..0ab7a787 100644 --- a/CompilePalX/Compilers/CompileExecutable.cs +++ b/CompilePalX/Compilers/CompileExecutable.cs @@ -47,6 +47,15 @@ public override void Run(CompileContext c) Process.Start(); Process.PriorityClass = ProcessPriorityClass.BelowNormal; + //VRAD can only use up to 16 cores, more cores reduces performance, and increased compile time. + //By assigning affinity to the process significantly speed up compiles on CPUs with more than 16 cores. + if (this.Name == "VRAD" && + Environment.ProcessorCount > 16) + { + //Hex 0xffff means core use core 0 through 15. + Process.ProcessorAffinity = (IntPtr)0xffff; + } + if (Metadata.ReadOutput) readOutput(); }