Skip to content

Poor performance overall #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LPGhatguy opened this issue Jul 31, 2015 · 31 comments
Open

Poor performance overall #317

LPGhatguy opened this issue Jul 31, 2015 · 31 comments

Comments

@LPGhatguy
Copy link

I'm running the Sublime Text 3 build 3083, latest stable, and I started getting extreme performance issues using this plugin.

When I have no tsconfig.json file, it looks like this plugin tries to parse all of my dependencies every time I type a semicolon, which stalls the entire text buffer. Adding a noParse entry to a tsconfig.json file fixes this issue, and changes nothing about the resulting file completion.

@hoanhtien
Copy link
Contributor

@LPGhatguy Could you provide the following information to help us reproduce this issue:

  • Could you send us a repro file/project?
  • Do you have other plugins installed?
  • Do you see any error printed in the Sublime console (before and after typing a semicolon)?
  • Do you install the plugin via package control (latest version is v0.1.7) or download it from Github?
  • Are you on a PC or a Mac? How fast is your machine?

@LPGhatguy
Copy link
Author

It's on my work system and I'm at home, but here's some partial information:

  • It's a 2012 iMac running the latest version of OS X
  • The package was installed via Package Control
  • No other plugins installed

I didn't check for errors in the console, but I can when I get in on Monday.

The bare minimum project I got the error occurring on had:

  • a package.json with dependencies on jQuery, Handlebars, MomentJS, lodash, and coreJS
  • a typings folder with .d.ts files for each of the above dependencies
  • a main.ts that references each of the definition files, and imports each module

@LPGhatguy
Copy link
Author

I checked this morning and there are no errors, but I do see

insert
queue timeout

every time I insert a semicolon with several libraries as dependencies.

The only place I see that throws a message like that is typescript/libs/node_client.py

@LPGhatguy
Copy link
Author

I'm getting this same issue on my Windows 10 system at home, also with a bare minimum project. This project has the structure:

  • src
    • client
      • main.ts
      • ModuleA.ts
    • server
      • main.ts
      • ModuleB.ts
  • tsconfig.json

Where my tsconfig.json is just:

{
    "compilerOptions": {
        "module": "system"
    }
}

@LPGhatguy
Copy link
Author

This problem has gotten to the point where it's causing my editor to hang indefinitely when adding imports to a file. The editor resumes operation when I kill my Node executable.

As a sidenote, this is using io.js 3.0, @hoanhtien.

Here's an error log from after I kill the node process: http://hastebin.com/ezekacuhah.txt

It appears that this is not related to the tsconfig.json file.

@LPGhatguy LPGhatguy changed the title Poor performance without 'noParse' field in tsconfig.json Poor performance overall Aug 16, 2015
@zhengbli
Copy link
Contributor

Is it possible you can put out the small project somewhere that we can test on it? io.js might be the problem as we've been testing on node only. And judging from the error log, it keeps trying to config the formatting options, which happened before when people are using the 'vintage' mode. Are you using it by any chance? Thanks

@LPGhatguy
Copy link
Author

@zhengbli, I'm not using vintage mode on either of the machines I experienced slowdowns on.

The real-world project I hit the issue on most recently is here. It's not completely boiled down, but I hit the issues in both source files within src/server.

@billti
Copy link
Member

billti commented Aug 18, 2015

We had some perf issues with the module resolution logic. We just implemented a change on the TypeScript side to improve this significantly (see microsoft/TypeScript#4154 ). This will be in the TypeScript 1.6 release (or you could build TypeScript from master and take the tsserver.js from their to dogfood it now).

@hoanhtien
Copy link
Contributor

I see no performance issue when editing https://github.com/LPGhatguy/basis/blob/master/src/server/main.ts on a machine with io.js v3.1.0.

@LPGhatguy
Copy link
Author

I haven't had any issues either since upgrading to io.js 3.1.0 -- perhaps it was one of the fabled memory leaks?

@LPGhatguy
Copy link
Author

I've hit more performance issues again. It seems to correspond with type completion dying.

Could it be related to #348? There's a ton of I/O going on in the plugin it seems.

I followed @billti 's suggestion and I'm running the latest 1.7-dev as my tsserver now, which seems to have solved a bunch of other issues as well.

@zhengbli
Copy link
Contributor

Can you show some of the I/O session that was recorded on your machine?
Some of the I/O are logged verbosely for debugging purpose, though it could also be something broken in the communication chain between the editor and the server. If you see a "timeout" message normally it is something bad happened.

@LPGhatguy
Copy link
Author

Where would that I/O be logged by the plugin? The only indicator I had was a large number of temporary files in the plugin directory with open file handles (ie I couldn't delete them when Sublime was open).

@zhengbli
Copy link
Contributor

Oh I thought you meant a lot of command histories showed in the sublime console. Then #348 might be related, if that happens the same time with your perf issues.

@amamf
Copy link

amamf commented Nov 7, 2015

I was suffering from the same problems, sublime was hanging very often, my problem was solved by adding "node_modules" into tsconfig -> excludes.

@CatPlanet
Copy link

Nothing helps.

Windows 7, node 4.3.2, bower 1.7.7, gulp CLI 1.2.1
TypeScript with Angular 1.

@OliverJAsh
Copy link

I am seeing very poor performance when editing https://github.com/guardian/frontend/blob/master/static/src/deploys-radiator/app/main.ts.

Sublime does not hang, but it takes about ~10 seconds for type information to appear in the toolbar when I select an identifier.

Interestingly I see the same problem in VSCode.

@zhengbli
Copy link
Contributor

@OliverJAsh What is your TS version? I tried cloning the repo and open with the latest tsserver in TypeScript master, typing information pops up instantly though.

@zhengbli
Copy link
Contributor

@CatPlanet what is your tsconfig.json file content?

@OliverJAsh
Copy link

@zhengbli I'm using the TS version that comes bundled with this plugin I believe?

@OliverJAsh
Copy link

I am able to reproduce the slowness when I have the following code:

var a = Promise.resolve('');
var n = Promise.all([
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])]),
    Promise.all([Promise.all([Promise.resolve('')])])
]);

n;

Obviously this is a slightly contrived example, but the code I'm having trouble with does make heavy use of Promises.

Tested in VSCode again and it seems fine, so I'll be using that for all TS projects now.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 18, 2016

@OliverJAsh I see the slowness you're talking about whenever I enter a semicolon, which freezes any typing. I believe you can set "typescript_auto_format": false in your options. See https://github.com/Microsoft/TypeScript-Sublime-Plugin/#features for more details.

Otherwise, it does take surprisingly long to get quick info at a given location as well.

@binarious
Copy link

I'm also seeing this. Having node with 100% CPU usage using this plugin with an Angular2 project on the basis of angular2-webpack-starter. After a while Sublime Text becomes unresponsive and freezes for a couple of seconds. The problems disappear when I disable the TypeScript plugin. It's been unusable for months and still is.

OS X 10.11.5
Mac Pro late 2013

@zhengbli
Copy link
Contributor

zhengbli commented Jun 28, 2016

@binarious @OliverJAsh so we have released a new version (0.1.14) with the auto_format disabled, do you still see the lag?

@binarious
Copy link

@zhengbli Thank you. The freezing seems to be fixed, but autocompletion suggestions still take up to 5 secs and the method popup takes ~2 secs for me.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 30, 2016

do you use a tsconfig.json? is it the same one you use to build? if so can you run the compiler tsc --diagnostics and share what you see?

@binarious
Copy link

@mhegazy Yes I do. Here's the tsconfig.json and the output of tsc --diagnostics: https://gist.github.com/binarious/4ede58609d5ffa0fb704d2cdaf1cba99

@mhegazy
Copy link
Contributor

mhegazy commented Jun 30, 2016

The time spent in the checker seems excessive. what version of tsc are you using? is there a chance you can share your project? do you see the same behavior on vscode?

@zhengbli
Copy link
Contributor

zhengbli commented Jun 30, 2016

Also is it true that you have more than 2k files in your project? As most of the errors reported in the log are from the node_modules folder

@binarious
Copy link

Well it seems to be fixed since I included this commit into my project just now: PatrickJS/PatrickJS-starter@8add16d
tsc --diagnostics is now error-free:

Files:             591
Lines:           58684
Nodes:          200519
Identifiers:     74628
Symbols:      19892562
Types:           17996
Memory used:   147637K
I/O read:        0.04s
I/O write:       0.02s
Parse time:      0.70s
Bind time:       0.42s
Check time:      1.64s
Emit time:       0.17s
Total time:      2.93s

Maybe it was a problem with a wrong exclude rule that led to the parsing of the whole node_modules folder. Autocomplete suggestions are now almost instantly shown. Thank you for your time.

@skunkworker
Copy link

I just ran into this issue tonight, when I try to change the selection it is unbearably sluggish. I brought up the Plugin Event Profile and TypeScript.typescript.listeners.listeners on_selection_modified is taking 11 seconds to run.

on_selection_modified:
    TypeScript.typescript.listeners.listeners: 11.020s total, mean: 0.001s, max: 0.309s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests