Vcpkg spawns processes with IDLE_PRIORITY_CLASS
, causing slow builds with low CPU usage on Windows #42715
Description
Describe the bug
Build related processes like Ninja spawned by vcpkg seem to have a very low priority, causing the build to use very few CPU cores despite setting the VCPKG_MAX_CONCURRENCY to a high value.
Environment
- OS: Windows
- Compiler: revision
To Reproduce
Steps to reproduce the behavior:
- ./vcpkg install xxx
- Bring up Task Manager
- Right click on Ninja.exe, go to details
- Right click and look at the priority
- It is Low
Expected behavior
At least give it a normal priority!
Additional context
The issue is caused by this in windows_create_process
which vcpkg uses to spawn subprocesses on Windows. For some reason, the priority is set to IDLE_PRIORITY_CLASS, which according to the doc, 'run only when the system is idle'. This is probably affecting the performance of vcpkg for years as it was introduced in the very beginning of the commit history.
By setting the value to NORMAL_PRIORITY_CLASS, I was able to fix this issue. Please change this or make this configurable. I would be happy to make a pr if this is indeed a bug.