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

Overall perf. issue with TypeScript(JS) #72362

Closed
berkaytheunicorn opened this issue Apr 15, 2019 · 29 comments
Closed

Overall perf. issue with TypeScript(JS) #72362

berkaytheunicorn opened this issue Apr 15, 2019 · 29 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@berkaytheunicorn
Copy link

Issue Type: Performance Issue

  • When did this performance issue happen?
    After updating to 1.33 (everything is still fine at 1.32)
  • Does it occur on startup or after a specific series of actions?
    It happens when you need to use TypeScript Intellisense.

PS: I didn't experience this in a TypeScript Project, My Project is a ES6 JS Project.

It really got messy when you try to cmd/ctrl+click to anything.

PS2: removing TypeScript cache helps a bit but after an hour it became slow again

VS Code version: Code 1.33.1 (51b0b28, 2019-04-11T08:22:55.268Z)
OS version: Darwin x64 18.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz (8 x 2000)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 3, 2
Memory (System) 8.00GB (0.09GB free)
Process Argv
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
   22	    90	 44270	code main
    6	    49	 44271	   gpu-process
    5	   262	 44272	   window (glocalzone (Workspace))
    0	   156	 44421	     extensionHost
    0	   492	 44427	       electron_node tsserver.js 
    0	    74	 44437	         electron_node typingsInstaller.js typesMap.js 
    0	   467	 44428	       electron_node language-server-stdio.js 
    0	    57	 44430	       electron_node server.js 
    0	    98	 44431	       electron_node eslintServer.js 
    0	    33	 44438	       /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/jsonServerMain --node-ipc --clientProcessId=44421
    1	    49	 44460	       electron_node server.js 
    0	   147	 44511	       extensionHost
    0	   123	 44521	       extensionHost
    0	   139	 44523	       extensionHost
    0	    25	 44422	     watcherService
    0	    41	 44426	     searchService
    0	    74	 44423	   shared-process
    0	    74	 44546	   window (Issue Reporter)
    0	     0	 44551	   /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
Workspace Info
|  Window (glocalzone (Workspace))
|    Folder (gz-api): 98 files
|      File types: js(66) graphql(11) json(9) DS_Store(4) yml(1) graphqlrc(1)
|                  babelrc(1) sh(1) gitignore(1) lock(1)
|      Conf files: package.json(1) webpack.config.js(1)
|    Folder (gz-app): more than 24620 files
|      File types: hpp(7604) flat(2181) h(1749) pcm(835) timestamp(790)
|                  png(611) jar(579) hmap(240) xml(202) m(194)
|      Conf files: package.json(1) settings.json(1);
Extensions (21)
Extension Author (truncated) Version
sublime-cmd-shift-d and 1.2.2
vscode-eslint dba 1.8.2
es7-react-js-snippets dsz 2.2.1
gitlens eam 9.6.0
vscode-npm-script eg2 0.3.5
prettier-vscode esb 1.8.1
path-autocomplete ion 1.13.2
styled-components-snippets jon 0.1.7
vscode-styled-components jpo 0.0.26
vscode-wrap-console-log mid 1.7.2
vscode-versionlens pfl 0.22.0
macos-dark-mode-theme phi 0.2.7
vscode-graphql Pri 0.1.7
subtle-brackets raf 3.0.0
code-settings-sync Sha 3.2.8
stylelint shi 0.48.0
mdx sil 0.1.0
indenticator Sir 0.6.0
ignore-gitignore stu 1.0.1
selectline-statusbar tom 0.0.2
vscode-import-cost wix 2.12.0

(1 theme extensions excluded)

@mjbvz mjbvz self-assigned this Apr 15, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 15, 2019

Does this reproduce in the latest VS Code insiders build with all extensions disabled?

@xserber
Copy link

xserber commented Apr 16, 2019

Does this reproduce in the latest VS Code insiders build with all extensions disabled?

Yes, on the insider assembly, in my TypeScript project (TSX) this is repeated.

@berkaytheunicorn
Copy link
Author

I forgot to mention this but beside the slowness, intellisense got not so intelligence :) (go to wrong root definitions or just stuck at same definition)

@vscodebot vscodebot bot removed the new release label Apr 16, 2019
@mjbvz mjbvz added the info-needed Issue requires more information from poster label Apr 22, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 22, 2019

@berkaey Did you test on insiders? Also, do you have @types/styled-components in your node_modules?

@berkaytheunicorn
Copy link
Author

No I didn't. and No both workspace folders doesn't have @types/styled-components in node_modules.

@berkaytheunicorn
Copy link
Author

btw, @mjbvz, you mean insiders version? if it so, how can i download it ?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 23, 2019

https://code.visualstudio.com/insiders/. Test with all extensions disabled

@berkaytheunicorn
Copy link
Author

Hey @mjbvz, I tested for 10 mins without any extensions, I guess it is much better than 1.33 but I think still has slower navigation on some case and sometimes it goes to import definition first sometimes it just goes to file itself.

@berkaytheunicorn
Copy link
Author

@mjbvz, after a full-day test on insider(with extensions) issue still stands. A bit more fast than 1.33 but lags behind 1.32

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 24, 2019

@berkaey So this didn't happen when you disabled all extensions?

Also, can you share your project?

@berkaytheunicorn
Copy link
Author

I tested without extensions only 10-20 min. 'cause I'm much slower without extensions :). Do you mean workspace file?

@codepunkt
Copy link

@mjbvz We're using @types/styled-components. What's the deal with them?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 26, 2019

@berkaey If this only happens when extensions are enabled, then one of your extensions is causing this.

If you can share your project (as a github repo) then we can investigate this better

@berkaytheunicorn
Copy link
Author

berkaytheunicorn commented Apr 27, 2019

@mjbvz it is happening without extensions also, (but bit better from 1.33) I'm using same extensions on 1.32 and works flawlessly. (I'm actually had to use 1.32 otherwise all of my MacBook Pro fans just hit the ceil :) too much cpu usage I guess)

@swashata
Copy link

swashata commented May 2, 2019

I do have styled-components and it happens with me also. Here's a list of possibly heavy libraries I am using

  1. React/React DOM
  2. Apollo Client with react-apollo.
  3. Styled components.
  4. Ant design.

I am using the following version of vscode

$ code --version
1.33.1
51b0b28134d51361cf996d2f0a1c698247aeabd8
x64

I think it is slow mostly on tsx files.

@mjbvz
Copy link
Collaborator

mjbvz commented May 2, 2019

@berkaey Can you try changing your workspace to use [email protected] by following these instructions. If using the older typescript works in current VS Code builds, then try switching to the current nightly build of typescript by installing typescript@next to see if the issue has been resolved

@berkaytheunicorn
Copy link
Author

berkaytheunicorn commented May 2, 2019

@mjbvz I'm not using typescript, no tsx files in my workspace (but as you now most of the node_modules libs are typed like styled-components etc.)

@mjbvz
Copy link
Collaborator

mjbvz commented May 2, 2019

Typescript powers our javascript intellisense. Try those steps

@swashata
Copy link

swashata commented May 3, 2019

@mjbvz Do you think it is happening because of this issue in typescript itself?

I investigated because it was not only vscode which was slow, rather fork-ts-checker-webpack-plugin results too. So I did some benchmarking and

For typescript version 3.4.5 with @types/[email protected]

yarn typecheck  11.16s user 0.56s system 154% cpu 7.611 total

For typescript version 3.5.0-dev.20190502 with @types/[email protected]

yarn typecheck  8.66s user 0.53s system 168% cpu 5.452 total

Overall vscode ts intellisense is much faster now. Also fork-ts-checker plugin performs better.

@natew
Copy link

natew commented May 3, 2019

I'm also getting this, not using styled-components. At one point I had narrowed it down to [email protected], but upgrading to their new types in the 9 beta and it's still slow.

@swashata
Copy link

swashata commented May 3, 2019

Also for typescript 3.3.4000 with @types/[email protected]

yarn typecheck  6.79s user 0.39s system 171% cpu 4.180 total

So think switching to typescript 3.3.4000 until the problem in upstream is solved is a viable solution for now?

@mjbvz
Copy link
Collaborator

mjbvz commented May 14, 2019

Sounds like this could be microsoft/TypeScript#31341

To check this, can you please try upgrading your workspace to use the next typescript@next that is published (3.5.0-dev.20190513+) by following these instructions

@swashata
Copy link

I tried with typescript@rc and the performance improvement is significant and things are back to normal. So with the release of [email protected] it should be resolved.

Here are more details https://devblogs.microsoft.com/typescript/announcing-typescript-3-5-rc/

@mjbvz
Copy link
Collaborator

mjbvz commented May 21, 2019

@berkaey Can you please confirm by testing using the latest VS Code insiders build, which includes TS 3.5-rc

@natew
Copy link

natew commented May 21, 2019 via email

@johnkahn
Copy link

@mjbvz I was also experiencing slowness in 1.34.0 and I just tried 1.35-insider with all 50ish extensions and it's much faster 🔥 Thanks!

@berkaytheunicorn
Copy link
Author

@mjbvz let me check the 1.35-insider

@berkaytheunicorn
Copy link
Author

After a quick test, I would say it is more responsive but still lags when I first open a file and cmd+click on an import, (I'm not sure but) when I open insider fans immediately kicks in for a period of time (this could be reason for first issue). After the fans got cooled, smooth as 1.32. 👍

@mjbvz
Copy link
Collaborator

mjbvz commented May 23, 2019

Closing. A spike in cpu usage is expected on first open

@mjbvz mjbvz closed this as completed May 23, 2019
@mjbvz mjbvz added *duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels May 23, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

7 participants