Performance issues in Visual Studio

Topics: General
Jan 8, 2013 at 5:02 PM

I've got a moderately-sized TypeScript project - about 5000 lines spread over about 30 files. I've discovered that as the project gets larger, the TypeScript plugin for Visual Studio starts slowing down, sometimes dramatically, to the point where Visual Studio will frequently lock up for 10-20 seconds before accepting input again. So far as I can tell, this seems to happen because of the TS language service trying to parse the files. It especially seems to happen when there's a syntax error of some sort within the file I'm editing - the sort you get and fix a thousand times a day while you're in the process of editing your code.

It's getting worse, and is beginning to affect productivity.

Do you know when the next drop of the VS plugin is going to be? Any tips for getting the best performance until then?

Jan 8, 2013 at 5:30 PM

Speak from personal experience --

For 2500+ lines of TS, I am not noticing a significant lag in design-time syntax/type checking. Though, this could purely be attributable to hardware. 

Jan 8, 2013 at 5:40 PM

Is it possible that you also have the Web Essentials plugin installed and have it set to compile after save?

Jan 8, 2013 at 6:07 PM

I have seen this occasionally in certain situations when the code is malformed in certain ways (e.g. missing braces, etc).  I can't put my finger on a pattern for it.

However, in general it seems that perf is not an issue (I'm very sensitive about perf too).  I have a similar sized project: roughly about 10K LOC over about 60+ files.

I have Web Essentials set to compile on save, not on build.

Do you have an SSD by any chance?  I had to switch to one to be able to accomplish any medium to heavy JS work in VS.

Jan 8, 2013 at 6:35 PM

Thanks for the responses. Some more data:

- I'm using WebEssentials 2.2.5, configured to compile on save but not on build. The evidence that it's not related to Web Essentials is that the freeze generally happens when I'm in the process of making live edits, before I save anything. Once I'm able to save a file, it generally builds within a second or so.

- My machine is a 32-bit machine, 3-4 years old, 4 GB of RAM, and a good SSD. It's not a great machine, but not bad. VS normally performs fine.

- Restarting Visual Studio definitely seems to help, at least for a while.

Jan 8, 2013 at 6:36 PM

We have noticed this occurring with certainty in the following circumstance: 

There is a duplicate declaration of a type or variable in the project (or projects).

I believe this causes the intellisense mechanism to lock itself up, but only for a short while - the 10 to 20 seconds sounds about right.

 

By chance we've discovered the following black magic for unlocking the spell:

  • When Visual Studio locks up, click on any other open window on the operating system.
  • Click back in Visual Studio and hit Control+break multiple times.
  • Stop doing that and immediately try clicking on another open document tab within Visual Studio

At this point the cursor should start being active again.

May or may not work for you!

Noel

Jan 8, 2013 at 8:24 PM

I believe this can also happen when declaration files (".d.ts") are referenced from within the same project as the actual source files declaring those types.

Jan 9, 2013 at 1:33 AM
I have a decent size TS project, ~200 files. The issue with duplicate declaration issue is easily reproduced by copy/pasting an existing TS file and then immediately open the new copied file = VS will freeze for quite some time. This behavior seems to be related to WebEssentials, if I disable it the freeze doesn't happen.
---bjorn


From: [email removed]
To: [email removed]
Date: Tue, 8 Jan 2013 17:15:38 -0800
Subject: Re: Performance issues in Visual Studio [typescript:428909]

From: nabog
We have noticed this occurring with certainty in the following circumstance:
There is a duplicate declaration of a type or variable in the project (or projects).
I believe this causes the intellisense mechanism to lock itself up, but only for a short while - the 10 to 20 seconds sounds about right.

By chance we've discovered the following black magic for unlocking the spell:
  • When Visual Studio locks up, click on any other open window on the operating system.
  • Click back in Visual Studio and hit Control+break multiple times.
  • Stop doing that and immediately try clicking on another open document tab within Visual Studio
At this point the cursor should start being active again.
May or may not work for you!
Noel
Read the full discussion online.
To add a post to this discussion, reply to this email (typescript@discussions.codeplex.com)
To start a new discussion for this project, email typescript@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com
Coordinator
Jan 9, 2013 at 5:28 PM

As a side note - we're also actively working to improve the compiler to make it faster for larger projects.  One such project is on CodePlex, and is a major re-write of the parser frontend to make it faster, simpler, and more capable (http://typescript.codeplex.com/SourceControl/network/forks/cyrusn/fidelity).