Skip to content

Intellisense refactoring extremely slow when using pnpm #42870

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

Closed
wdamien opened this issue Feb 18, 2021 · 4 comments
Closed

Intellisense refactoring extremely slow when using pnpm #42870

wdamien opened this issue Feb 18, 2021 · 4 comments
Assignees
Labels
Duplicate An existing issue was already created

Comments

@wdamien
Copy link

wdamien commented Feb 18, 2021

Issue Type: Bug

I switched my react/typescript project to use pnpm to improve my CI build times, this lead to a massive slow down with the intellisense import suggestions. On the order of 3 - 5 seconds just to populate the context menu. If I used the "Add all missing imports" feature that could take a few minutes to complete (for a lot of missing imports this was literally ~10 minutes before it timed out out on me). I tested with all my extensions disabled, and still had the same performance issue. Cleaning my node_modules, and using npm or yarn to install the modules fixed it.

Repo:

  • In a medium or large sized typescript project; Clean out your node modules rm -rf node_modules/
  • Use pnpm to install everything. pnpm i
  • Open a file and add some missing references, and try to use intellisense to import the missing references, notice the slow import times.
  • Try the "Add all missing imports" options and notce the time it takes to load. This repos best with a long of missing imports like 10 or so. After ~10 minutes VS code displayed this error in an alert: Running the contributed command: '_vscode_delegate_cmd_klb4cauz' failed.

VS Code version: Code 1.53.2 (622cb03f7e070a9670c94bae1a45d78d7181fbd4, 2021-02-11T11:45:54.515Z)
OS version: Darwin x64 19.6.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 3, 3
Memory (System) 16.00GB (0.98GB free)
Process Argv -psn_0_114716 --crash-reporter-id 8e076c0e-bbd2-411c-aaf9-118c864294b9
Screen Reader no
VM 13%
Extensions (41)
Extension Author (truncated) Version
xd ado 1.1.2
azurite Azu 3.11.0
spellright ban 3.0.56
emojisense bie 0.8.0
markdown-checkbox bie 0.1.3
vscode-intelephense-client bme 1.6.3
path-intellisense chr 2.3.0
codeswing cod 0.0.11
dart-code Dar 3.19.2
flutter Dar 3.19.0
vscode-eslint dba 2.1.14
xml Dot 2.5.1
gitlens eam 11.2.1
tsl-problem-matcher eam 0.3.1
EditorConfig Edi 0.16.4
prettier-vscode esb 5.9.2
vscode-jest-runner fir 0.4.31
auto-close-tag for 0.5.10
react-native-snippet jun 0.5.6
vscode-gutter-preview kis 0.26.2
vscode-language-babel mgm 0.0.30
import-sorter mik 3.3.1
dotenv mik 1.0.1
vscode-apache mrm 1.2.0
vscode-scss mrm 0.9.0
vscode-azurefunctions ms- 1.2.1
vscode-azurestorage ms- 0.11.0
remote-wsl ms- 0.53.4
azure-account ms- 0.9.6
node-debug2 ms- 1.42.5
powershell ms- 2020.6.0
vscode-typescript-tslint-plugin ms- 1.3.3
debugger-for-chrome msj 4.12.12
vscode-react-native msj 1.4.0
vscode-jest Ort 3.2.0
vscode-css-navigation puc 1.10.3
code-settings-sync Sha 3.4.3
vscode-scss-formatter sib 2.1.0
gistfs vsl 0.2.2
markdown-all-in-one yzh 3.4.0
html-css-class-completion Zig 1.20.0
@mjbvz mjbvz transferred this issue from microsoft/vscode Feb 18, 2021
@mjbvz mjbvz removed their assignment Feb 18, 2021
@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Feb 23, 2021
@RyanCavanaugh
Copy link
Member

RyanCavanaugh commented Feb 23, 2021

We'd need an actual repo to test this in order to investigate further; if just any pnpm setup caused this, we would have other reports of it by now.

@wdamien
Copy link
Author

wdamien commented Feb 23, 2021

Here's a simple project that repos the issue. This was tested using the same machine listed in the issue.

Steps:

  • Install the node modules using pnpm pnpm i (tested using v5.17.3)
  • In the App.tsx; delete the import {...} from '@fluentui/react'; line.
  • Attempt to automatically import one of the missing controls. Notice the top progress bar animates, but no suggestions are given. (see extra details below). You can help this out by manually adding a single import, ex: import { PrimaryButton } from '@fluentui/react';, then try the other imports.
  • Clean out node_modules; rm -rf node_modules
  • Use yarn to install (npm also works); yarn
  • Retry the import. Notice that it works immediately.
  • When using the "Add all missing imports" its noticeably slower running with the pnpm installed vs yarn.
  • I tried restarting to TS server and a full window refresh, but neither seem to change anything.

Extra details:

After the first install using pnpm, intellisense sometimes is just broken when trying to import from node_modules. Using the cmd + . menu says there are "No code actions available.". After a while that fixes it self, I don't have an exact time here, but the imports do eventually start working when using pnpm. When using the "Add all missing imports", and switching between yarn and pnpm, you can see that it's noticeably slower running the import when pnpm has been used. On a real project this just seems to get compounded with the number imports being used, so keep adding imports and the import speed gets slower and slower. The project I noticed this issue on has 100 .ts/.tsx files and, if this matters, 670 total imports. I could cause that extreme import time by removing 15 or so imports from a larger file and trying "Add all missing imports".

Let me know if I can provide any other details.

TestProject.zip

@RyanCavanaugh RyanCavanaugh added Needs Investigation This issue needs a team member to investigate its status. and removed Needs More Info The issue still hasn't been fully clarified labels Feb 23, 2021
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.3.0 milestone Feb 23, 2021
@andrewbranch
Copy link
Member

Duplicate of #40584 (fixed in 4.2). If you use the nightly extension (or just use the TypeScript 4.2 RC) you should be able to verify that it’s fixed for you.

@andrewbranch andrewbranch added Duplicate An existing issue was already created and removed Needs Investigation This issue needs a team member to investigate its status. labels Feb 23, 2021
@wdamien
Copy link
Author

wdamien commented Feb 25, 2021

Using Typescript 4.2.2 this is much better. yarn is still noticeably faster. Just tried a quick test when importing 10 missing imports. Using with the yarn install was ~10 seconds, pnpm was ~16 seconds. That's completely within an acceptable range now.

@wdamien wdamien closed this as completed Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants