Skip to content

Auto import suggestions heavily slows intellisense #32174

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
ProTip opened this issue Jun 28, 2019 · 5 comments
Open

Auto import suggestions heavily slows intellisense #32174

ProTip opened this issue Jun 28, 2019 · 5 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@ProTip
Copy link

ProTip commented Jun 28, 2019

TypeScript Version: 3.6.0-dev.20190628

Search Terms: auto import auto import performance

Code

Enter this into a blank TypeScript project in VSCode:

import {S3} from 'aws-sdk'

const a: s

Expected behavior:
Intellisense suggestions to pop up in under 500ms.

Actual behavior:
2+ seconds for the suggestions to appear.

After banging my head for a few hours trying to get to the bottom of intellisense slowness(next, insiders, old versions, etc, etc) I narrowed this down to auto import suggestions; disabling this feature removes the delay. I believe tsserver provides this service to VSCode? The aws-sdk does have a huge type surface area..

@asvetliakov
Copy link

Same issue here. Using aws-sdk only in a few files but it slows down whole project

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jul 10, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jul 10, 2019
@RyanCavanaugh
Copy link
Member

It's not clear what to do here - people looove auto-import, but clearly there are too many things in aws-sdk to performantly offer. It'd be a bummer if the feature just "turned off" when a complex library was around, but there's no obvious culling strategy for reducing the number of things in the list when there are too many.

@ProTip
Copy link
Author

ProTip commented Jul 18, 2019

I haven't had the chance to dive into this(I have never looked at the code in this project so I'm pretty much procrastinating) but I had hoped it was just an algorithm choice or caching issue.. But isn't everything? 😄

For my part I usually care more about auto-import suggestions for my own code. Having that option may be a nice stop-gap for people who don't want to completely disable it.

Outside of that perhaps fuzzy-ish search through all the available types could be disabled? And/or a prefix index? I'm just spit-balling here as I have no clue as to why it should be so dang slow. Really I suppose I or somebody else would need to hook up the profiler and figure out where the time is(could be VSCode).

@Pajn
Copy link

Pajn commented Sep 23, 2019

Databases can search through millions of items in no times. A lot of exports from any library should not be a problem with the correct data structure and algorithm.

If you want to provide suggestions while typing it sounds like the classbook example of a problem solved by a radix index/tree.

@OliverJAsh
Copy link
Contributor

I filed a suggestion for VS Code to show some suggestions whilst waiting for auto import suggestions, so that other suggestions are not slowed down by auto import suggestions: microsoft/vscode#138449. Unfortunately the issue was closed, but if there's no way to improve performance on TypeScript's side then I think this issue should be re-opened. It would be great if other people could chime in on that issue.

For now, I've had to disable auto import suggestions entirely because they are so slow.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants