4

Oftentimes when building a large solution with many projects in Visual Studio 2010, Windows 7 Resource Monitor will show that devenv.exe as Not Responding, however Average CPU reads a low number like 0.91 like shown:

Visual Studio 2010 slow build on AMD Phenom II x4

and this is on Windows 7 x64 with a AMD Phenom II 920 4-core CPU, 8 GB RAM. Visual Studio is not responding, yet it hardly seems to be using any CPU resources.

When I tried running the build with msbuild.exe and the switch "/maxcpucount:4", the Average CPU value still stays low, and the RHS graphs never show a value above 5-10%.

Why doesn't Visual Studio 2010 (or msbuild) seem to be taking advantage of the CPU(s) during a build?

4
  • 7
    There is so much more to a computer's performance than a CPU. For instance; how much time is spent reading your solution from disk? Commented Jul 16, 2011 at 3:22
  • If your system is running low on memory, you're going to start thrashing your page file like mad and compiles will slow to a crawl. A large translation unit with lots of #includes can easily consume hundreds of megabytes. Multiply that by the number of parallel processes, and you can easily consume gigabytes. Commented Jul 16, 2011 at 3:45
  • @vcsjones I checked my disk usage in Resource Monitor when opening a project, and noticed that it approaches 1 MB/s. @Adam I have seen Windows 7 sometimes show a 'low on memory' message when I've opened several large solutions and I haven't rebooted in a while, but in this case I was using 3-4 out of 8 GB RAM. Commented Jul 16, 2011 at 4:00
  • I was thinking the same and the answers here dont seem to explain that much. Im using 17% of CPU. 30% RAM. 1% disk. Why doesn't it take advantage of my machine. Builds seem to take the same time on a supercomputer or a potato. Doesnt makes sense. It would have been better for me to buy 5 rubbish computers and build across them with Incredibuild. Commented Feb 5, 2020 at 16:31

3 Answers 3

5

Building a project potentially involves a lot of disk I/O. This can take a fair bit of time, but will not produce much in the way of CPU load.

As for why it shows as not responding, my guess would be that the build process is for some reason (as in, someone did a poor job of implementing it) blocking the application from responding to requests from the OS. An application doesn't need to reach 100% CPU utilization to be considered "Not Responding", it just needs to get its main thread stuck somewhere that prevents it from responding to the OS in a timely fashion.

Sign up to request clarification or add additional context in comments.

1 Comment

It is only using 1% disk for me and is slow as hell. Not using much CPU or RAM either. Why not take advantage of the resources.
2

It seems that MSBuild does not like to build multiple projects in parallel, only multiple files in one project in parallel.

4 Comments

How does this answer help with the question?
The original question is "Why doesn't Visual Studio 2010 (or msbuild) seem to be taking advantage of the CPU(s) during a build?" My answer is meant to imply that all the other answers do not fit into what I'm experiencing. The top answer here says that it is an I/O issue. This is completely not the case. I have a 4x Vertex3 RAID0 drive array and a computer with 24 logical cores with 192 GB of RAM building these projects. Unless I set the /MP parameter (which builds multiple files in 1 project), my CPU utilization stays at the 1-core mark.
Ah, ok. The wording 'does not like' threw me off. So you're saying that you had to override the default (presumable backwards compatible, safe) default of not building in parallel?
No, what I mean is that Visual Studio supposedly will build projects in parallel. However, this does not seem to be the case. The /MP parameter will allow the compiler to compile multiple files that belong to the same project. However, this is a big problem because we want multiple non-dependent projects to be built in parallel. This is not isolated to that one machine either. We have everything from netbooks to 40-core servers that experience the same behavior.
0

Why is it slow and doesn't work as expected? Well, because its built from scratch using cutting edge technologies. That's why!

(Rant: VS 2010 is huge step back IMHO. VS 2008 is much more stable/responsive (and works) but lets leave the personal opinions aside)

Two workarounds to take adavantage of multiple cores:

  • Set MSBuild as an external tool as outlined here and assign it a shortcut (like Ctrl+Shft+B) for quick access.
  • Set BuildInParallel attrib of MSBuild task to true

    <Target Name="RunInParallel"> <MSBuild BuildInParallel="true" Projects="@(Projects)" Targets="RunCodeAnalysis"> </MSBuild> </Target> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.