Skip to content

Slow completions request not cancellable while collecting auto-importsΒ #44826

Closed
@OliverJAsh

Description

@OliverJAsh

Bug Report

πŸ”Ž Search Terms

auto completions complete suggestions performance slow vs code typing

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about performance

⏯ Playground Link

N/A

πŸ’» Code

  1. Clone and checkout https://github.com/unsplash/unsplash-web/tree/typescript-completion-performance, branch typescript-completion-performance. This is a private repository but I believe some members of the TS team already have access from debugging previous issues. If you don't have access, please send me your email address so I can provide access (TS team members only).
  2. Run yarn to install TS
  3. Open VS Code, navigate to the file app/helpers/my-test.ts and wait for TS to finish initialising

Type O. and wait for completions to appear.

πŸ™ Actual behavior

Completions should appear quickly.

πŸ™‚ Expected behavior

Completions appear slowly.

tsserver.log

web.mov

In the TS server log we can see that completions are slow:

Info 1961 [11:58:01.660] request:
    {"seq":8,"type":"request","command":"completionInfo","arguments":{"file":"/Users/oliverash/Development/unsplash-web/app/helpers/my-test.ts","line":3,"offset":2,"includeExternalModuleExports":true,"includeInsertTextCompletions":true}}
Info 1962 [11:58:01.660] Starting updateGraphWorker: Project: /Users/oliverash/Development/unsplash-web/tsconfig.app.json
Info 1963 [11:58:01.841] Finishing updateGraphWorker: Project: /Users/oliverash/Development/unsplash-web/tsconfig.app.json Version: 2 structureChanged: false Elapsed: 180.94832699745893ms
Info 1964 [11:58:01.841] Different program with same set of files:: structureIsReused:: 2
Info 1965 [11:58:01.843] getCompletionData: Get current token: 0.007962003350257874
Info 1966 [11:58:01.843] getCompletionData: Is inside comment: 0.03854600340127945
Info 1967 [11:58:01.843] getCompletionData: Get previous token 1: 0.015626996755599976
Info 1968 [11:58:01.844] getCompletionData: Get previous token 2: 0.1929429993033409
Info 1969 [11:58:01.844] getCompletionsAtPosition: isCompletionListBlocker: 0.3775179982185364
Info 1970 [11:58:01.850] collectAutoImports: starting, not resolving module specifiers
Info 1971 [11:58:01.850] collectAutoImports: module specifier cache size: 0
Info 1972 [11:58:01.999] getSymbolToExportInfoMap: cache miss or empty; calculating new results
Info 1973 [11:58:02.589] getSymbolToExportInfoMap: caching results
Info 1974 [11:58:02.589] getSymbolToExportInfoMap: done in 738.1664780005813 ms
Info 1975 [11:58:02.847] collectAutoImports: done in 996.4206670001149 ms
Info 1976 [11:58:02.847] getCompletionData: Semantic work: 1002.4234960004687
Info 1977 [11:58:02.978] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 130.66120900213718
Perf 1978 [11:58:02.996] 8::completionInfo: elapsed time (in milliseconds) 1336.2221

The response for the completionInfo command contains an enormous body (see full log file) which seems to describe the exports for every single module in the TS project. I find this surprising considering we're only asking for the exports of one module.

I tested this in a fresh VS Code instance with no extensions.

I also tested this in a new folder and it was much faster.

tsserver.log

simple.mov

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions