Skip to content
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

Data in source code make language service slow #17051

Closed
thorn0 opened this issue Jul 10, 2017 · 2 comments
Closed

Data in source code make language service slow #17051

thorn0 opened this issue Jul 10, 2017 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@thorn0
Copy link

thorn0 commented Jul 10, 2017

TypeScript Version: 2.4.1

Code

Add a long array of number literals passed to the Uint8ClampedArray constructor anywhere in the project:

var a = new Uint8ClampedArray([ 0, 0, 0, /* ... 25000 times ... */, 0 ]);

In my case it was a separate file (module), but it doesn't matter.

You can generate the code to paste using this snippet in the browser console:

copy('var a = new Uint8ClampedArray([ ' + '0, '.repeat(25000) + '0 ]);')

Expected behavior:

Having that much data in the code isn't exactly a great idea, but I didn't expect it to slow down the language service that badly. I use VS Code, but it happens on the Playground as well.

Actual behavior:

The autocompletion, tooltips, etc. become really slow. It doesn't have to be the same file where that big array is. On my machine, when I hover any variable anywhere in the project, it takes up to 10 seconds for the tooltip to show up.

However, it works fine this way:

var arr = [ 0, 0, 0, /* ... 25000 times ... */, 0 ];
var a = new Uint8ClampedArray(arr);

Which seems to be a good enough workaround. I only found it after I submitted this issue.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 23, 2017

checking the file is fairly quick. looks like we are choking in the language service operations.

@ghost
Copy link

ghost commented Sep 22, 2017

Should be fixed by #18619

@ghost ghost closed this as completed Sep 22, 2017
@ghost ghost added the Fixed A PR has been merged for this issue label Sep 22, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants