Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm running out of patience with MS VisualStudio 2010: I'm working on a solution containing ~50 C++ projects. When using the editor, I experience a lag of 1 - 2 seconds whenever I move the cursor to a different line, or when I move to a different window, or generally when the editor losses and gains focus.

I went through a whole series of optimizations, to no avail:

  • installed all hotfixes for VS2010
  • disabled all add-ins and extensions
  • disabled Intellisense
  • deleted all temporary files created by VS2010
  • disabled hardware acceleration
  • unloaded all but 15 projects
  • disabled tracking changes
  • closed all but one window

and so on.

This is on a Dual Core machine with SSD harddrive (verified throughput > 100MB/s), enough free space on HD, Windows 7 Pro 32-bit with 3GB of RAM and most of it still free.

Whenever I type a letter, CPU usage of devenv.exe goes to 50 - 90% in process monitor for 1 - 2 seconds before returning to 5%.

I used Process Explorer to analyze registry and file system access, and I only notice frequent accesses to the .sln file (which is quiet small), and a few registry reads, but nothing that would raise a red flag.

I don't have this problem with solutions containing less projects, so I'm inclined to think that it's related to the number of projects. For your information, the entire solution has been migrated over the years from VS2005 to VS2008 to now VS2010.

Does anyone have any ideas what else I could do to resume work on this project, other than returning to VS2008?

share|improve this question
5  
Do you have the McAfee virus? – ChaosPandion Jan 28 '11 at 16:57
No - I'm using Avira, but disabled the on-access scanner. In any case, the problem doesn't seem to be related to file system access. – Daniel Gehriger Jan 28 '11 at 16:58
8  
@Daniel - I feel for you, one of the worst parts of VS2010 is the rather steep decline in performance for large solutions. (Language is irrelevant.) – ChaosPandion Jan 28 '11 at 17:00
2  
Shouldn't this be on SU? – Matthew Read Jan 28 '11 at 22:00
2  
I found that the hardware-accelleration produced this problem at my PC. – user28099 Jun 17 '11 at 8:56
show 2 more comments

closed as off topic by gnat, MainMa, Yannis Rizos Mar 7 '12 at 12:29

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

6 Answers

up vote 25 down vote accepted

I tried attaching WinDbg to VisualStudio 2010 to observe its behavior, and I noticed a large number of CLR exceptions.

The exceptions are all generated by StyleCop. I thought I disabled all add-ins, but apparently, StyleCop was still hooked into VS2010, even though it wasn't listed in the add-ins list. Anyway, after uninstalling it, VS2010 agains works at "full" speed!

So there may be an incompatiblity between StyleCop and VisualStudio 2010 solutions with a large number of C++ projects.

share|improve this answer
Have you tried adding back all the projects? (I would still keep them removed in the future though.) – ChaosPandion Jan 28 '11 at 21:28
It appears you answered your own question. I did notice some issues upgrading VS2010 and the plugins I had for VS2008. I ended up uninstalling and reinstalling all of them to get it to work properly. – Berin Loritsch Jan 28 '11 at 21:29
Yes, I re-added all projects, and I don't notice any major lag (I'm not saying its blazing fast, but the 1-2 second delays after each focus switch are gone). But I will keep those plug-in projects unloaded anyway, so they won't recompile after each minor code change. – Daniel Gehriger Jan 28 '11 at 21:34
10  
+1 Observing what's really happening : the only way to optimize! – Klaim Jun 17 '11 at 8:59
5  
1. Start a first instance of VisualStudio, and load your solution. 2. Start a 2nd instance of VisualStudio (you may have to right-click and "Run as Administrator..."). 3. Go to "Debug > Attach to Process...". 4. Make sure that next to "Attach to:" you have "Native code", otherwise add it (using Select...). 4. In the process list, look for "devenv.exe", then click "Attach...". 5. Check the Output window for exception messages. – Daniel Gehriger Aug 19 '11 at 7:13
show 4 more comments

Are you working on all 50 C++ projects at the same time? If you are not, it seems to me that you could reference the compiled DLL's (instead of the source code) for the projects you are not working on, and greatly speed up this process.

One way to improve Intellisense performance for large C++ projects is to enable Pre-Compiled Headers usage for the Intellisense parser. Andy Rich has written a detailed post on intellisense PCH usage that gives some additional details and explains how to optimize your intellisense engine with PCH.

share|improve this answer
I'm not working on all projects at the same time, which is why I unload most of them. The unloaded projects are not referenced by the other code in any way (they are plug-ins). Also, the lag persists, even if I disable Intellisense. – Daniel Gehriger Jan 28 '11 at 17:17
Well, what could the IDE be thinking about when you type a character, if it is not intellisense? Maybe it's not really disabled? – Robert Harvey Jan 28 '11 at 17:20
It's disabled in the VS options, and I don't get any of its functionalities. I can be thinking about plenty of things, such as syntax highlighting for instance. – Daniel Gehriger Jan 28 '11 at 17:33
But maybe I should attach a debugger and see where it blocks. – Daniel Gehriger Jan 28 '11 at 17:33
In any case, I'll try using PCHs in the project to see if this changes anything. However, it's not straight-forward, as there isn't a simple list of common headers to be included. – Daniel Gehriger Jan 28 '11 at 20:09
show 1 more comment

"If your right hand offends thee, cut it off." There are a number of great editors out there that can be used in lieu of VS. Consider using an external editor for your code.

share|improve this answer
For example here's a tip on how to use VIM as your editor vim.wikia.com/wiki/Integrate_gvim_with_Visual_Studio – Mike Brown Jan 28 '11 at 17:22
This is not an option, unfortunately. This is a large commercial project, and I need the GUI, DB and other design capabilities of VS. – Daniel Gehriger Jan 28 '11 at 17:32
You still have VS, you just replace the editor with a different one. – Mike Brown Jan 28 '11 at 18:54

If you have many projects that you don't need on a daily basis. Compile them so that you have outputs for dependencies. Then, right click on 'em, unload project.

This speeds up the IDE and Intellisense tremendously.

share|improve this answer

Also read this posts:

VS2010 is so terribly slow now that I can't work with it anymore; every key stroke results in a freeze of the application that holds for (tens of) seconds. We are going to replace the hard-disk for an SSD drive. After reading some discussions this is likely to be a candidate to solve the problem. I keep you informed (and my fingers crossed).

Update March 20, 2012. See comment.

share|improve this answer
Update March 20, 2012. I have replaced the hard disk for an SSD this morning. My first cautious conclusion is that my problems with VS are just gone. It reacts like it should on editor changes and compiling goes very fast. Just before replacement I worked with VS on the regular hard disk and again it was terribly slow. It looks like SSD is the silver bullet for me. By the way, copying the OS from the hard disk to the SSD was a piece of cake thanks to the SATA Quick Port Pro LAN docking station. – Vincent Mar 20 '12 at 9:52
I admit that replacing the hard disk is not a real solution because now we are solving a problem caused by Visual Studio itself. It ought to behave normal on a system with a regular hard disk. – Vincent Mar 20 '12 at 10:00

Your bottleneck is likely ram.

I found on my old machine with an intel core2 6600 with 3g ram, just one open instance of visual studio 2010 was horribly slow.

Now I'm working on a dual xeon 5160 blade with 8g ram and it's LIGHTNING fast. I can open half a dozen visual studios with large solutions and nothing slows them down. That's with Resharper running as well.

share|improve this answer
Thanks for your answer. But no, it's not RAM: there is still free memory, so if VS needed more RAM, it could just go ahead and commit it. – Daniel Gehriger Jan 28 '11 at 21:35
Definitely wouldn't be the ram. I'm using a i7 2nd Gen 2.7GHz, 8GB with a solid-state hard drive and it’s still sluggish. Perhaps you'd just got used to VS2010 performance. It’s even more noticeable with a SSD, as all my other applications are ridiculously fast. It’s the vista of visual studio. Looks great, nice features but shockingly slow. – Nickz Oct 12 '11 at 3:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.