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

Automatic import suggestions slow down Luau LSP #749

Closed
Dizyreal opened this issue Aug 20, 2024 · 5 comments
Closed

Automatic import suggestions slow down Luau LSP #749

Dizyreal opened this issue Aug 20, 2024 · 5 comments
Labels
bug Something isn't working performance Performance issues with the language server

Comments

@Dizyreal
Copy link

When this property is enabled, Luau LSP works slower than usual, and there appears delay before automatic suggestions are shown.
image

Also when Import Ignore Globs are empty, Luau LSP works way faster (2x-3x) even with enabled auto import suggestions.

@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Sep 11, 2024
@JoelBrd
Copy link

JoelBrd commented Nov 5, 2024

Second this.

@Mewious
Copy link

Mewious commented Nov 6, 2024

bump

1 similar comment
@ColRealPro
Copy link

bump

@kennethloeffler
Copy link

@Mewious @ColRealPro

It's great that you're enthusiastic about getting this fixed, but repeated messages that only say variations of "bump" will not make the issue get resolved faster since issues are not prioritized based only on recent activity, and disrespect the time of the author and others who follow activity on this repository because they'll get notifications for these messages which don't add any useful information or insights.

It's better to add some information that might actually help the issue get resolved, for example:

  • a workaround
  • more details on how to reproduce the issue
  • the particular circumstances in which you're seeing the issue

If you just want a status update, that's fine - but it's more appropriate for this to happen in e.g. this project's Discord channel and avoid cluttering the issue with it.

@JohnnyMorganz
Copy link
Owner

JohnnyMorganz commented Nov 10, 2024

Been looking into this one, indeed the main culprit seems to be the call to WorkspaceFolder::isIgnoredFileForAutoImports.

Suggest imports currently takes 15s on my example code base.

image

If I remove that call, the request goes down to 1.2s, where suggest imports takes 387ms. Interestingly, the computation of the actual completion items takes ~500ms, but we we pay ~600ms just to return that result back to the language client (most likely all the cost to serialize it back to JSON, so we may need to look into the size of the result and performance of our JSON library afterwards).

image

The cost for isIgnoredFileForAutoImports either comes from the path manipulation or the glob matching, so it is worth profiling the 2 to see if we can optimise it better. If there doesn't seem to be any easy wins, we can probably also cache the result of the ignore check so it's a 1 time cost (when creating the sourcemap).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Performance issues with the language server
Projects
None yet
Development

No branches or pull requests

6 participants