While waiting for shaders to compile while I was packaging a build for an Unreal Engine 4 project, I started poking around in Task Manager and noticed that ShaderCompileWorker.exe, the helper program UE4 spawns to compile shaders, had low processor priority. A bit frustrated with how long the shader compilation was taking, I right-clicked on each of my instances of ShaderCompileWorker.exe in my Task Manager details and jackedtheir priority up to high in the hopes that this allow them to get more time on the CPU and consequently finish faster.
While I was right-clicking, I got to wondering if there would be a way to do this using the command-line so I could, say, do this priority elevation in a batch file. A bit of Googling later and I had the following command:
wmic process where name="ShaderCompileWorker.exe" call setpriority "high priority"
Running this command grabs each running process on my machne and sets its priority to high. I haven’t had a chance to test if this actually decreases the amount of time I spend compiling shaders, but there is a bit of peace of mind to be had in imagining ShaderCompileWorker.exe not being preempted for CPU time by the playlist of 80’s cartoon openings I had running while I was packaging a build.