TypeScript project feels very slow

Answered

Hi to all,

I'm currently working on TypeScript with IntelliJ IDEA on Windows 8.

The whole IDE feels very slow, typing updates are slow, code completion is very slow, ...
JavaScript or Java projects feel blazingly fast fast in comparison.
I already tried to disable live editing and file watcher, but IDEA  still feels slow.

Anyone else experienced this with TypeScript?
Any hints?

thx
Heinrich

19 comments
Comment actions Permalink

Hi Heinrich,

Could you please capture a CPU snapshot when IDE performs slow as described here?

0
Comment actions Permalink

Attached is mine. Note that this is a pretty tiny project.

$ tsc -v
Version 1.0.1.0
$ node -v
v0.10.31


Attachment(s):
IU-141.1010_raptor_19.05.2015_12.21.29.zip
0
Comment actions Permalink

Sorry, forgot to replay earlier.

My problem was that all type definitions from
https://github.com/borisyankov/DefinitelyTyped
where included in my project by using bower

bower install DefinitelyTyped 

That was too much to handle for IntelliJ, at least on my machine.
Only strange thing is, that IntelliJ got even slower over time while working.

Manwhile switched to
http://definitelytyped.org/tsd/
instead of bower to manage type definitions.
With having only required definitions in the project, everything runs mint.

regards
Heinrich
0
Comment actions Permalink

I'm also using tsd, and I only have two definition files for mocha and assert, and about 20 classes of my own.

0
Comment actions Permalink

Well in my case everything was terribly slow and CPU-consuming as well. Heinrich pointed me to the right direction:

It seems that the whole definitely typed collection that I installed with bower was the problem. There is no need to uninstall it though, simply exclude the bower_components/DefinitelyTyped directory (or as I did the whole bower_components directory):
Right click on the directory in the file pane -> Mark Directory As -> Excluded.

Now everything is fast as it should be :)

0
Comment actions Permalink

I have that terrible IDE freezes while editing or navigating the project. Almost every time I double click on a variable IDE freezes for about 5-10 seconds. Could you help me please?

Here is my CPU snapshot with a double click freeze: https://drive.google.com/open?id=0B1eb1UDgQDmBOHozRFJQX3hPWU0 

0
Comment actions Permalink

Do you face the issue with TypeScript or other frameworks also influenced?

Please attach your typescript settings "File | Settings | Languages & Frameworks | TypeScript".

Also please try doing "File | Invalidate caches". Does it help?

0
Comment actions Permalink

I use TypeScript, React, Redux and Relay.

Typescript settings attached.

"Invalidate caches & restart" helps for some time. But after 1 or 2 hours lags come back.

0
Comment actions Permalink

Is any additional information required? More lags occur when there are errors in code. I use mac os 10.12.3, core i7, SSD, 16 Gb Ram. Help me please. I don't want to go to another IDE like VSCode :(

0
Comment actions Permalink

Could you please try to use bundled TypeScript version and disable Typescript Service?

0
Comment actions Permalink

I've tried a bundled version. Can't see the difference. Some time after start it runs almost normal. But then it becomes laggy. Especially when there are errors in my code. 

1
Comment actions Permalink

No updates :(

Webstorm is a great tool. But sometimes it's just impossible to use it effectively. I'm switching to another IDE :(

2
Comment actions Permalink

I'd like an update on this as well. For me it takes 5 to 10 seconds for autocomplete to work, which is pretty unusable to say the least. The project I'm working on does have a lot of dependencies, but still it shouldn't take that long.

I wish the autocomplete/auto import was as fast as it is on java projects but I guess that's pretty hard to achieve :/

1
Comment actions Permalink

I'm running into this issue on 2017.1 EAP as well. IntelliJ spits out a thread dump every time that I save a TS file, and everything freezes for a few seconds.

I don't see a way to attach files to this post or I would attach the thread dumps, but it looks like the most relevant threads have about the same frames every time and com.intellij.lang.typescript.imports.ES6ImportOptimizer.processFile(ES6ImportOptimizer.java:83) is pretty far down in the trace.

Is there any way to disable import optimization for TypeScript to see if this resolves the issue? Import optimization is a pretty low need for me. It's a nice feature to have, but my imports aren't getting as crazy as they do with Java.

 

0
Comment actions Permalink

I haven't been able to find any way to disable "Optimize imports" on save for TypeScript files. I've tried disabling all options under Settings > Editor > Code Style > TypeScript > Imports with no success. I've also disabled everything under Settings > Editor > General > Auto Import with no success.

This has a significant impact on productivity. Is there any way to prevent IntelliJ from organizing imports on save?

Also, I'm not seeing this issue in 2016.3.4, so I reverted for now. Unfortunately this seems to break Angular CLI support for its latest versions. I know there's a ticket open for this which was resolved for 2017.1 which was why we decided to try the EAP in the first place.

0
Comment actions Permalink

Please report a bug to YouTrack with threaddumps attached: http://youtrack.jetbrains.com/issues/WEB  

 

 

-1
Comment actions Permalink

I had the same problem and I solved it by giving IntelliJ IDEA ample memory by modifying idea64.exe.vmoptions

I am not going to list the magic values that worked for me here because there already exist several posts on the subject.

0

Please sign in to leave a comment.