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

slow intellisense/type checking #53618

Closed
seansfkelley opened this issue Jul 5, 2018 · 14 comments
Closed

slow intellisense/type checking #53618

seansfkelley opened this issue Jul 5, 2018 · 14 comments
Assignees
Labels
info-needed Issue requires more information from poster typescript Typescript support issues

Comments

@seansfkelley
Copy link

seansfkelley commented Jul 5, 2018

Issue Type: Bug

Possibly related issues: #51819, #53541

1.24.x appears to have introduced a performance regression for performance in Typescript projects. The type checking process frequently hovers at 100% for several seconds at a time, with a corresponding lack of updates in the UI (red underlines where they don't make sense, out of date type information, Intellisense stating that it's "Loading...").

I switched to the insiders build and disabled all extensions and the issue persists.

This is especially bad when there's a lot of churn, such as changing branches or even when making a quick sequence of edits. Anecdotally, the longer said sequence of edits is the longer the type checker hangs, up to a limit where it appears to catch up (5-10 seconds or so? I haven't timed it). Changes made in one open file are often slow to be reflected in another open file (such as when I change the type of a value).

Is there a way to downgrade to 1.23.x? Both so it works better for me and so I can help verify that it was indeed 1.23 -> 1.24 that caused the problem. What other debugging information would help?

VS Code version: Code - Insiders 1.25.0-insider (0f080e5, 2018-07-04T14:06:34.850Z)
OS version: Darwin x64 17.4.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)
GPU Status 2d_canvas: enabled
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
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 3, 3
Memory (System) 16.00GB (0.06GB free)
Process Argv /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
Screen Reader no
VM 0%
Extensions: none
code-insiders --status
Version:          Code - Insiders 1.25.0-insider (0f080e5267e829de46638128001aeb7ca2d6d50e, 2018-07-04T14:06:34.850Z)
OS Version:       Darwin x64 17.4.0
CPUs:             Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)
Memory (System):  16.00GB (0.18GB free)
Load (avg):       3, 3, 3
VM:               0%
Screen Reader:    no
Process Argv:     /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
GPU Status:       2d_canvas:                    enabled
                  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
                  video_decode:                 enabled
                  video_encode:                 enabled
                  vpx_decode:                   enabled
                  webgl:                        enabled
                  webgl2:                       enabled

CPU %   Mem MB     PID  Process
    3      131   52530  code-insiders main
    3       98   52531     gpu-process
    7      328   52532     window (SiteService.ts — clues-frontend)
    0       98   52538       extensionHost
   99      344   52542         electron_node electronForkStart.js tsserver.js
    0       49   52554           electron_node typingsInstaller.js tsserver.js typesMap.js
    0       66   52560         electron_node jsonServerMain.js
    0       49   52539       watcherService
    0       49   52571       searchService
    0       82   52540     shared-process
    2       82   52577     window (Process Explorer)

Workspace Stats:
|  Window (SiteService.ts — clues-frontend)
|    Folder (clues-frontend): 268 files
|      File types: js(80) tsx(77) ts(37) scss(33) json(6) yml(3) md(3)
|                  woff2(2) png(2) ico(2)
|      Conf files: tslint.json(2) makefile(1) package.json(1) tsconfig.json(1)
|                  settings.json(1)
@mjbvz mjbvz self-assigned this Jul 6, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jul 10, 2018

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

@mjbvz mjbvz added info-needed Issue requires more information from poster typescript Typescript support issues labels Jul 10, 2018
@matpag
Copy link

matpag commented Jul 11, 2018

@mjbvz I had the same problem, when i disabled all the extensions the problem disappeared on VS Code 1.25.0.
Btw i didn't installed new extensions from when i was on version 1.23.1 and at the time there were no problems with all the extensions enabled.

@maritz
Copy link

maritz commented Jul 11, 2018

I am experiencing this with 1.25.0 as well, the problem with finding a cause or validating a fix is that it dosen't instantly happen on starting vscode. It builds up over time where after a couple of hours the typechecker becomes unusably slow and even just typing becomes very unresponsive (takes up to a second sometimes after a few hours of work).

The rest of my system is running completely fine in the meantime. One of 8 virtual cores (4 real cores with HT) is often used 100% by the vscode tsserver for a few seconds after saving a file. But everything else is below 10% usage and RAM is also still available, SWAP completely untouched.

External tsc watchers and webpack builders are continuing to run fine without needing restarts even after days of running.

I have however definitely experienced it with all extensions disabled in the stable 1.25.0.

Testing the insider builds right now.

@seansfkelley
Copy link
Author

seansfkelley commented Jul 11, 2018

FWIW I downgraded to 1.23.x and the problem went away. I'll try to reproduce in the next couple days on the latest insiders build but as @maritz has noted it takes a bit to get there as it's not a binary working/broken reproduction but more of a slow descent into sadness.

@maritz
Copy link

maritz commented Jul 11, 2018

Hm, not sure if it's related, but starting to select text in a file with some very long lines completely freezes vscode for several seconds in the insiders build.

Otherwise it has been relatively stable today without any extensions installed. If it doesn't deteriorate tomorrow, I will try some extensions.

@maritz
Copy link

maritz commented Jul 13, 2018

So far everything is fine with 2 extensions re-installed on insider build: prettier and tslint.

I'll try my full set of extensions over the next few days now.

@maritz
Copy link

maritz commented Jul 17, 2018

So far so good.

Some unrelated problems, but the slowdowns did not appear for me with the following extensions installed:

  • Bracket Pair Colorizer
  • Docker
  • Document This
  • EditorConfig for VS Code
  • Gitlens
  • markdownlint
  • Prettier
  • TSLint

I had a much shorter list on 1.25 at one point, so this list should have definitely triggered it imo.

@seansfkelley
Copy link
Author

seansfkelley commented Jul 17, 2018

Mine was mostly better for a few days until yesterday when the same issues seem to have returned noticeably.

I noticed some more patterns in the behavior: the delay is easiest to trigger when using go-to-definition to go to a file I haven't visited yet (or in some time) and is accompanied by a large jump in memory usage of the tsserver.js extension process noted in the original report (sometimes up to ~200mb in a single shot). Memory usage of that process tends to hover at around 1.1gb; unsure if that's normal or not.

I still see other instances of the problem, such as very long wait times for Intellisense to come up with a list of suggestions, but the pattern for those is harder to identify. When that does happen, it tends to stick around for a while, which is to say that a file/workplace in a bad state doesn't seem to get better over time like it might with a simple empty-cache issue.

I had reinstalled the TSLint, EditorConfig and GitLens extensions but disabled them for a couple hours prior to observing the above symptoms. The process explorer still indicates that tsserver.js is the direct cause, though I don't know how it relates to the extensions.

@maritz
Copy link

maritz commented Jul 17, 2018

@seansfkelley Did you try insiders or still on 1.25?

@seansfkelley
Copy link
Author

Oops, sorry; this is 1.26.0-insider 7e992cab07f6d3faf5a137e8ca0d094f8dffeee6.

@seansfkelley
Copy link
Author

seansfkelley commented Jul 18, 2018

Here's an example of the types of issues that crop up routinely. I was editing code higher up in the file, which was of course breaking syntax further down in the file. The message is obviously erroneous
but this file never refreshed itself even once the file was again syntactically valid and should have type-checked.

I had time to take both of these screen shots, write this comment and then edit it, before I gave up and ran "Reload window",* at which point the file (without further edits) was considered valid, as it should be.

Extensions are still disabled; insiders version d1272ff8edbaa54c81382f82fa2091f63ed3daea. This editing session was with Typescript 3.0.0-rc, though I originally filed the issue using 2.9.2.

* "Reload project" doesn't ever seem to help.

image

image

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 18, 2018

Please try collecting the TS Server log:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a folder with a tsserver.log file in it

Look through that log file for errors or stack traces. If you can share the log, I can also take a look to see if anything stands out

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@vscodebot vscodebot bot closed this as completed Jul 26, 2018
@vscodebot
Copy link

vscodebot bot commented Jul 26, 2018

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@seansfkelley
Copy link
Author

FWIW, these performance issues have been slowly tapering off, so I haven't seen cases as egregious as originally cited. I still have no idea what caused the issue in the first place (bad combination of libraries? over-aggressive cache clearing? slow filesystem?) but I've been staying on the insiders build and it's been improving back to the point where it used to be.

If the issue returns, I'll try to collect some useful logs before reopening.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

4 participants