During large project builds, it is usually useful to do other stuff
with your computer (like checking out the latest cool stuff on CodeGuru 🙂 ),
but I find that the computer becomes very sluggish, until I change the
priority of the vcspawn.exe and cl.exe to low using the NT task manager.
After doing so, the computer becomes quite responsive until the next build…
Since Microsoft didn’t provide an option to automatically run the compiler/linker
in low priority, I’ve figured a way that easily does this. What I have done is
located in the vcspawn.exe executable, the call to CreateProcessA(). One of the
parameters (dwCreationFlags) includes the priority at which you wish to run the created process.
Vcspawn.exe normally runs everything with the dwCreationFlags
set to 0x00000200, which decoded means use only the CREATE_NEW_PROCESS_GROUP flag.
What I wish to include in the dwCreationFlags parameter is the flag, IDLE_PRIORITY_CLASS
which is 0x00000040, so my replacement dwCreationFlags is 0x00000240 – a one byte
difference. After making the simple one byte edit, all my builds are performed in low
priority mode. Now you may think that by running at low priority, all your builds will
take longer to complete, but you will be surprise at the little difference in actual
build times, unless you were doing some other heavy duty task.
To make the one byte edit, first backup
Program FilesMicrosoft Visual StudioMSDev98Binvcspawn.exe
and then from inside DevStudio, open in BINARY mode, vcspawn.exe. Bring up
the Go To dialog by typing, control-g, and key in the address 0x27ec and close the
Go To dialog. The byte should be 00 with the previous byte being 68 and the following
byte being 02. If they are not, then you are running a different version of vcspawn.exe
and you shouldn’t attempt the change. If they are, then you can just type in the replacement
byte of 40. The new byte sequence starting at 0x27eb should now read 68 40 02. Save and
close the file. Now all further builds will be performed in low priority.
Note for VC++ 5.0 vcspawn.exe, you can do the same type of change at address 0x0e49, changing
the byte from 00 to 40.