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

perf(lsp): cancellable TS diagnostics #13565

Merged
merged 3 commits into from
Feb 2, 2022

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Feb 1, 2022

Adds the ability to cancel generating TypeScript diagnostics while they're being generated. I'm not sure how to test this to see what kind of improvement this may bring, but I assume it will be helpful.

cli/tsc/99_main_compiler.js Outdated Show resolved Hide resolved
cli/tsc/99_main_compiler.js Outdated Show resolved Hide resolved
@@ -217,6 +217,7 @@ impl DiagnosticsServer {
snapshot.clone(),
&config,
&ts_server,
token.clone(),
Copy link
Member Author

@dsherret dsherret Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change we might want to consider removing or reducing the 200ms delay on line 208.

Edit: I'm just trying out the big file benchmark to see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also antidotal evidence too by using a debug build and editing a large project in vscode... I can try to take it for a spin later... though if we drop that, we should do it as a follow up PR, I suspect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea! Though I just tested it now and removing the delay is still much slower ☹

Before (this PR):

Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown
      (10 runs, mean: 508ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1879ms)
   - Find/Replace
      (10 runs, mean: 78ms)
   - Code Lens
      (10 runs, mean: 612ms)
<- End benchmarking lsp

After (debounce removed):

Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 295ms)
   - Big Document/Several Edits 
      (5 runs, mean: 4668ms)
   - Find/Replace
      (10 runs, mean: 78ms)
   - Code Lens
      (10 runs, mean: 402ms)
<- End benchmarking lsp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test might not be triggering it, because I don't think it is sending and setting cancellation tokens. I think we would need to modify the test, based on observed messages to and from the server.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM implementation wise, but I'm unsure about the debouncing. I'll leave that to Kit

@dsherret dsherret merged commit 37aba8f into denoland:main Feb 2, 2022
@dsherret dsherret deleted the ts_cancellable_diagnostics branch February 2, 2022 14:25
ry pushed a commit to ry/deno that referenced this pull request Feb 3, 2022
ry pushed a commit to ry/deno that referenced this pull request Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants