This project is read-only.

High CPU usage from Visual studio process!

Topics: General
Dec 10, 2013 at 1:59 PM
I'm experiencing very high CPU usage from Visual studio process. For example, when I open .ts file in VS2013, CPU usage goes from 0 to 90% in 15 sec and then it needs at least 10 sec to drop down. So for 30 seconds there is very high CPU usage and system is very unresponsive. The same happens when I close ts file or just press a key in editor, so basically you are unable to work normally.

Here are some more information:
  • the same is if I use VS2012
  • if I work with .NET project, (much bigger; 300K+ LOC, 1000+ c# files) there are no problems
  • recently I upgrade my system from Windows 8 to 8.1, so I thought that there is connection. So I try clean VirtualBox system, clean VS2013, no addons, but results are the same.
  • currently I’m using 0.9.5, but I think the same was true with previous version. I just start to pay more attention now.
  • the only connection I see is that recently I’m constantly refactoring the project to single class per file, so I went from 30 ts files to a about 130. As project grows it is just not manageable to have files with more than 1 class.
The problem is also with compiling, because if I open some files, do some changes and then compile, the process will be much longer because VS is taking CPU from tsc.exe.

I would like to know if someone else has experience similar behavior. Is this the problem of project having lots of tsc files,…??

Dec 10, 2013 at 4:13 PM
A few questions that spring to mind:
  • Are all your files in one single project?
  • How are you referencing types?
  • Do you have any duplicate type declarations?
  • Do you have any circular references?
  • Are your referencing any d.ts with a large number of generics?
Set the build action to "None" for groups of .ts files and compile to see if the problem goes away. Repeat until you have found the offending file.
Dec 10, 2013 at 9:20 PM
Just wanted to chime in that I'm noticing this issue as well. I happened to install the 0.9.5 extension for Visual Studio 2013 today (previously on 0.9.1), and I started migrating some of our larger JavaScript files over to TypeScript and the performance seems to be getting worse and worse as I go along. Visual Studio hangs and the devenv.exe process is always showing CPU activity, even when I'm not doing anything within Visual Studio.
  • All of my files are in 1 project, and I even turned off "Compile on save". I have maybe 8 large definition files (JQuery, SharePoint, etc.), but only a few .ts files.
  • I'm not explicitly referencing any types; I'm relying on the new "auto-references" feature of the Visual Studio extension to search-and-reference all .d.ts files for me.
Dec 11, 2013 at 1:10 PM
Well which of your 8 large definition files is causing the problem? Should be easy enough to identify that.
Dec 11, 2013 at 2:39 PM
this was the first thing I have tried! To remove files, to found out which part may cause problems. But I was unable to point to single problem. Because with files removal performance increase gradually. Solution has 5 typescript project, but currently the biggest is server side build on node framework and without this performance are much better. There is certainly no circular references, because I have just refactor and remove all explicit references (using implicit referencing) except those coming from external project, but there are not lot of them.

Today I start to use “Redirect JS to out directory” and I can see little improvement, but I think mostly because git provider (Visual Studio Tools for Git) has less work, as out is part of .gitignore. Of course, I have done tests in Visual studio Safe mode and without Git provider, but without major improvements.

Dec 12, 2013 at 11:16 PM
Are any of you guys able to share your projects with us so we can try to debug the issue? (you can share it privately if you can't or don't want to post a publicly accessible version).
Dec 18, 2013 at 12:59 PM
I encountered same issue today, not sure if it caused by the way we reference ts files. will change to user _references.ts to see if this issue goes away.
May 1, 2014 at 8:24 AM
I was struggling with a very slow VS2013RC2 for the past few days.

Had recently included a bunch of JS libraries which VS was trying to index for intellisense.

Setting <autosync enabled="false" /> at the top of /Scripts/_references.js file brought down the 40% of CPU usage that VS was sitting with even at idle

Read more here