Hi, my name is Renin John and I work as a Software Development Engineer in Test with the VC++ Project and Build Team. I was involved in testing the Build performance of the VS 2010 IDE and I wanted to give you all an idea about what to expect, and some basic steps you could take if you end up in a situation where your project builds slower in VS 2010 than it did in VS 2008 or a previous version.
VS 2010 has better or equal performance in majority of the cases we have measured. However, if you’re hit by a build performance degradation, stay tuned and I will show you ways to investigate the issue, identify whether you are comparing apples to apples, figure out a way to improve the build performance and report bugs with appropriate level of detail so we can take action as quickly as possible.
On a side note, there is also a way to reset VS to the Out-of-Box state. Read the content under “/resetuserdata Switch” here. While "devenv /resetuserdata" does set Visual Studio 2010 configuration files to default, it does not reset the user configuration, which may have been modified by the user with specific settings. To do this, open up the VS 2010 command prompt and type in the command “del %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.*.user.props". This will remove the files containing the user specific settings, and these files will be recreated using Visual Studio 2010 defaults the next time that VS is started.
For a little background on why this is happening, VS does not create an entry in the project file whenever the property takes a default value.
Generating PDBs increases build time. Therefore, if your situation does not require generating PDBs, you could bring up the Property Pages of the project and disable Debug Information Format by clearing the value of the field corresponding to that property. To step it up a notch and further reduce build times, you may also disable the linker from generating PDBs: Open up the Property Pages, go to Configuration Properties –> Linker –> Debugging and set Generate Debug Info to “No”.
This should be implied but I’ll mention it anyways: Due to this issue, say you want to gain a meaningful understanding of the build time slowdown (if at all) in VS 2010, you could do so by eliminating the differences between the VS 2008 and VS 2010 builds. For this, enable “/O2” in VS 2008 and do a build before comparing it with the VS2010 build time. This applies to the “/Zi” case mentioned above as well (Enable “/Zi” in VS 2008 and build).
In VS 2010, an MFC app that links to its libraries statically shows reduced build performance In VS 2010, there has been a substantial growth of the MFC static libraries, which transforms into additional work for the linker while building (The size of the generated binary is also significantly larger as a result). It is actually caused by a new feature added, allowing MFC controls to be added to a dialog. This in turn required that the DLGINIT handler have knowledge about the MFC controls and this pulls in all the additional portions of the library. We see the benefit of the feature as outweighing the drawback of the additional size of a static EXE, so we do not want to pull the feature. We do, however, plan to address this issue in some way in a future release of Visual Studio. To work around this issue, consider linking to the MFC libraries dynamically. To do this, open up the Property Pages of the project, go to Configuration Properties --> General and change the "Use of MFC" property to "Use MFC in a Shared DLL". Microsoft recommends dynamic linking anyways. This allows users to immediately take advantage of any future security patches that may apply to these libraries without the vendor having to rebuild/reship their application.
This section contains suggestions for you to reliably measure the performance if you choose to do a Rebuild (Build -> Rebuild Solution).
A - Initial machine setup
B - Measuring Cold Timing
C - Gathering Warm Timings
Note: When you measure the time for the Rebuild Solution scenario, keep in mind that this involves the additional overhead of cleaning up files that were generated during a prior build. For consistency purposes, choose from one of the options listed below:
A build includes various pieces like MSBuild, IDE, Tools, Tasks ... Listed below are four steps to take to narrow down a slowdown to its root cause:
In the first case, you may create a repro by extracting any small file or project from the solution. While in the second case, extract a repro of just the particular file or project causing the slowdown. You should verify that you can reproduce the slowdown by just compiling or linking the extracted project, ideally by just running the actual command like cl.exe ... or link.exe … You may then use this repro to report the issue to us (There is a section on Reporting Bugs below). If you did see a wall clock regression for an entire build but no cl/link tools time slowdown, you have thereby eliminated the cl and linker, and can now proceed investigating the other tools (see Step 2).
Task Performance Summary: 0 ms SetEnv 4 calls 0 ms Touch 2 calls 0 ms ReadLinesFromFile 1 calls 0 ms Message 3 calls 0 ms Delete 2 calls 0 ms AssignCulture 1 calls 0 ms MakeDir 10 calls 0 ms WriteLinesToFile 1 calls 0 ms AssignTargetPath 5 calls 359 ms RC 1 calls 937 ms Mt 1 calls 3843 ms CL 2 calls 7061 ms Link 1 calls
Although you were done analyzing the compiler and linker times in Step 1, you might want to consider looking into their Task times reported here as well. If you see any regression, it would mean that the slowdown is stemming from the additional MSBuild overhead sub-tasks and not from the tool. You can then measure this exact time by subtracting the Task time from its respective tool time (calculated in Step 1; note, build log verbosity should have been set to Diagnostic in this case). Again, figure out if the slowdown is across the board or in a particular project. If you don't see a regression in any of these tools, it should most probably be a regression in MSBuild itself. However before concluding that, eliminate the IDE factor by performing Step 3.
If after going through the steps above, you still think that there is a performance issue that needs our attention, feel free to get in touch with us through forums if you need some clarification, or open a Connect bug if you would like something to be considered for fixing in a future release.
When getting in touch with us, please be as detailed as possible providing relevant information from the sections above. Provide all variability information regarding your machine configuration (type of processor, number of cores, amount of installed memory, free disk space, etc.)
Attach the project sources (if it does not violate any licensing terms). If there are license restrictions, try removing/obfuscating any IP and send it to us. If that is not feasible either, consider sending us just the solution (.sln) and project (.dsp/.vcproj & .vcxproj) files. Include Diagnostic logs (see section I.2; build output/log file verbosity setting should be changed to Diagnostic) with timing information enabled (/Bt and /time), along with ETW Traces.
Be detailed about the steps you took in narrowing down the issue and the percentage of slowdown you are observing after eliminating any disparities between the two builds that you are comparing. This will help speed up our investigations and enable us to respond to you quicker. Feel free to also provide any subjective observations you made while doing the exercise.
I would like to thank you all from my end for using Visual Studio 2010 and being patient enough to read this blog. If you have any questions/concerns/comments, throw them at me and I’ll be happy to respond to them.
Renin John Visual C++ Project and Build team