DEV Community

Cover image for Can I Have My CPU Back Visual Studio?

Can I Have My CPU Back Visual Studio?

Rion Williams on April 13, 2018

This was originally posted on my blog. Visual Studio 2017 has certainly been a major improvement over previous iteration of the flagship IDE; ho...
Collapse
 
dubyabrian profile image
W. Brian Gourlie

Visual Studio 2017 can often, without reason, start throttling the CPU of the machine more than 75% without the user doing anything.

The odd part about this whole thing is that sometimes the high-CPU usage will actually return to normal levels when you actually start performing operations (i.e. scrolling within the editor, typing, etc.). This can seem incredibly frustrating to diagnose and to live with.

There's a good chance that this is intentional. A lot of background processing (indexing, static analysis) is done when the user is idle. Once the user starts doing things, background processing is suspended for the sake of responsiveness.

Background processing can be especially taxing when working in large javascript codebases, because javascript is especially hard to analyze. You might want to try disabling some of the javascript analysis features (if it applies to you) and see if it helps with the CPU usage.

Collapse
 
rionmonster profile image
Rion Williams

Hi Brian!

Thanks for the reply!

In this particular case, the issue was only occurring (in scenarios that I could easily reproduce) in larger codebases and projects. After some digging and research, I determined that it was in fact the source control features within Visual Studio that were constantly trying to sync with the repository for the project in the background while I was attempting to get things done.

The issue itself had apparently been documented and was slated for a fix in a recent release/update to Visual Studio, so it may have been addressed already. The mentioned workarounds are great for folks that don't have the ability to easily update their environments or are simply being hamstrung by the issue itself and it is impacting their ability to work.

Thanks for the great suggestion regarding Javascript Analysis as I know that's one that can peg CPUs as well. In general, any sort of analysis can easily be configured to run at build-time to avoid interrupting daily operation. Other potential CPU hogs include extensions, which can be an entire beast on their own.

Thanks for the comment!

Rion

Collapse
 
twigman08 profile image
Chad Smith

If you use ReSharper and have full Solution Analysis on it can really bring your machine to a halt if it starts doing its processing while you want to do something else.

I love ReSharper and can't do MVC development without it, though in my case I've seen it be the root of Visual Studio bringing a machine down.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

Give VSCode a try?! 🚀 Just saying.

Collapse
 
thechrisjasper profile image
Chris Jasper

Not really helpful if you are working with pre .NET core C# codebases.