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

5 second delayed intellisense with Svelte Preprocess #1139

Closed
PuruVJ opened this issue Aug 16, 2021 · 21 comments
Closed

5 second delayed intellisense with Svelte Preprocess #1139

PuruVJ opened this issue Aug 16, 2021 · 21 comments
Labels
perf Performance

Comments

@PuruVJ
Copy link

PuruVJ commented Aug 16, 2021

Describe the bug
I have a 23 components big app, with TypeScript and SCSS. The intellisense for just about anything(Svelte related or JS related) inside .svelte files takes around 5-6 seconds to show up. In the very beginning when there was just 1 component, it was instantaneous.

This isn't a problem with my computer, because I get instantaneous intellisense in .js, .ts, .tsx file even with 100+ files in the project.

In this svelte app, the intellisense in .ts files is still instantaneous, so it's an issue with the Svelte extension only.

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo: https://github.com/puruvj/macos-web
  2. Run npm install
  3. Go to any Svelte file with some local state and try typing out variable names in the <script> tag or in the template or the snippets autocompletion of if, each, await blocks, etc. See the speed of intellisense
  4. Now, delete node_modules, go to the same .svelte file as before, and now try intellisense. It will be instantaneous now.

I think this issue is happening because of svelte-preprocess, because I have noticed this lag in every other Svelte project with TS/SCSS with svelte-preprocess, whereas projects without it are really fast.

Expected behavior
I want the intellisense to be as instantaneous with svelte-preprocess as it is is without it 🙂

System (please complete the following information):

  • OS: Windows
  • IDE: VSCode
  • Plugin/Package: Official Svelte extension for VSCode
@PuruVJ PuruVJ added the bug Something isn't working label Aug 16, 2021
@PuruVJ PuruVJ changed the title Slow intellisense with Svelte Preprocess 5 second delayed intellisense with Svelte Preprocess Aug 16, 2021
@dummdidumm
Copy link
Member

The intellisense gets slower for me as well, which is expected since there are now much more files the TypeScript language service has to scan. I don't see the massive slowdown you see however. Could you give more details?

  • which file exactly should I open, what exactly should I type to see it?
  • what exactly to you mean by "intellisense"? Auto completion suggestions?
  • Which version of the extension do you have installed
  • What's your hardware spec (roughly)?

@PuruVJ
Copy link
Author

PuruVJ commented Aug 17, 2021

Sure!

I noticed an additional thing that when I open the workspace in VSCode and open a .svelte file, the lag isn't that bad. It's like 1-2 seconds, which is manageable, but as I open more files and work on them, then it starts getting slower. Closing the files doesn't make it any faster.

And here are the details for your questions:

  • Open components/Dock/Dock.svelte, and type anywhere inside the template an if block, then put in the mouseX variable in the condition and notice autocomplete speed. or if you're in the each block, create an if block inside it and try typing any variable avilable in that scope
  • Autocomplete only, my bad 😅
  • v105.3.4
  • i5 8th gen processor, SSD, 8 GB RAM Windows 11 laptop

@dummdidumm
Copy link
Member

I tried to narrow this down, but no luck. The biggest delay I get is within a function of the TypeScript language service which we have no control over. I'm not sure if this is what slows this down for you. What you could try to narrow this down:

Add this to your user settings (JSON):

"svelte.plugin.css.enable": false,
"svelte.plugin.html.enable": false,
"svelte.plugin.svelte.enable": false

This should only keep the TS/JS intellisense of the extension enabled. Is this noticably faster then? If yes, by how much?
If it isn't, or it is a little faster but not that much, then you can go to the user settings and try to disable all language features except svelte.plugin.typescript.completions.enable. This should give you a good idea then of how much of the slowdown is directly related to the completions code path and not to some other synchronous code being executed and blocking the completion execution.
List of all settings (also found via VS Code settings UI): https://github.com/sveltejs/language-tools/tree/master/packages/language-server#list-of-settings

@PuruVJ
Copy link
Author

PuruVJ commented Aug 19, 2021

Hi, the delay has reduced to 2-3 seconds after I modified the settings json with your code. Which is manageable, but I rely on these features a lot, can't disable them 🥲

Thank you for your time

@dummdidumm
Copy link
Member

Disabling the settings was meant to narrow down where the slowdown comes from, not as a solution. If you reenable them one by one, which one does the have the most impact (my guess is svelte.plugin.svelte.enable)?

@PuruVJ
Copy link
Author

PuruVJ commented Aug 19, 2021

Ah ok, I'll try that

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Aug 24, 2021
Give certain requests priority.
If a request doesn't have priority, we first wait 1 second to
1. let higher priority requests get through first
2. wait for possible document changes, which make the request wait again

This hopefully makes perceived responsiveness of the language server better
sveltejs#1098, sveltejs#1130, sveltejs#1139
dummdidumm added a commit that referenced this issue Aug 24, 2021
Give certain requests priority.
If a request doesn't have priority, we first wait 1 second to
1. let higher priority requests get through first
2. wait for possible document changes, which make the request wait again

This hopefully makes perceived responsiveness of the language server better
#1098, #1130, #1139
@dummdidumm
Copy link
Member

dummdidumm commented Aug 24, 2021

The latest release includes some performance improvements, completions should have higher priority now. Please let me know if it improved for you.
Also, could you add "svelte.trace.server": "messages" to your user settings JSON, then reproduce your slowness for 1-2 minutes and then copy the output of the Svelte extension in here? I'm interested in the response times that are logged for the various requests.

@PuruVJ
Copy link
Author

PuruVJ commented Aug 24, 2021

Where do I see the output? 😅

@dummdidumm
Copy link
Member

At the bottom where the terminal is, there's a tab called "Output". Select it, then select "Svelte" from the dropdown to the right.

@PuruVJ
Copy link
Author

PuruVJ commented Aug 24, 2021

For adding this 👇

    {#if $openApps[appID]}
      
    {/if}

These are the outputs 👇

[Trace - 4:06:59 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:06:59 pm] Sending request 'textDocument/linkedEditingRange - (391)'.
[Trace - 4:06:59 pm] Received response 'textDocument/linkedEditingRange - (391)' in 2ms.
[Trace - 4:06:59 pm] Sending request 'textDocument/semanticTokens/full - (392)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:00 pm] Sending request 'textDocument/documentColor - (393)'.
[Trace - 4:07:00 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:00 pm] Sending request 'textDocument/linkedEditingRange - (394)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:00 pm] Sending request 'textDocument/codeAction - (395)'.
[Trace - 4:07:00 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:01 pm] Received response 'textDocument/semanticTokens/full - (392)' in 1405ms.
[Trace - 4:07:01 pm] Received response 'textDocument/linkedEditingRange - (394)' in 180ms.
[Trace - 4:07:01 pm] Received response 'textDocument/codeAction - (395)' in 137ms.
[Trace - 4:07:01 pm] Sending request 'textDocument/semanticTokens/full - (396)'.
[Trace - 4:07:01 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:01 pm] Sending request 'textDocument/completion - (397)'.
[Trace - 4:07:01 pm] Sending request 'textDocument/linkedEditingRange - (398)'.
[Trace - 4:07:01 pm] Sending request 'textDocument/documentColor - (399)'.
[Trace - 4:07:01 pm] Sending request 'textDocument/codeAction - (400)'.
[Trace - 4:07:01 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:01 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:02 pm] Sending request 'textDocument/linkedEditingRange - (401)'.
[Trace - 4:07:02 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:02 pm] Received response 'textDocument/completion - (397)' in 612ms.
[Trace - 4:07:02 pm] Received response 'textDocument/linkedEditingRange - (398)' in 599ms.
[Trace - 4:07:02 pm] Received response 'textDocument/codeAction - (400)' in 583ms.
[Trace - 4:07:02 pm] Received response 'textDocument/linkedEditingRange - (401)' in 198ms.
[Trace - 4:07:02 pm] Sending request 'textDocument/completion - (402)'.
[Trace - 4:07:02 pm] Sending request 'textDocument/linkedEditingRange - (403)'.
[Trace - 4:07:02 pm] Sending request 'textDocument/codeAction - (404)'.
[Trace - 4:07:02 pm] Sending request 'textDocument/documentColor - (405)'.
[Trace - 4:07:05 pm] Received response 'textDocument/completion - (402)' in 3347ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:06 pm] Received response 'textDocument/documentColor - (399)' in 4494ms.
[Trace - 4:07:06 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:06 pm] Received response 'textDocument/linkedEditingRange - (403)' in 3831ms.
[Trace - 4:07:06 pm] Received response 'textDocument/codeAction - (404)' in 3784ms.
[Trace - 4:07:06 pm] Received response 'textDocument/semanticTokens/full - (396)' in 5162ms.
[Trace - 4:07:06 pm] Received response 'textDocument/documentColor - (393)' in 6181ms.
[Trace - 4:07:06 pm] Received response 'textDocument/documentColor - (405)' in 3693ms.
[Trace - 4:07:06 pm] Sending request 'completionItem/resolve - (406)'.
[Trace - 4:07:06 pm] Received response 'completionItem/resolve - (406)' in 1ms.
[Trace - 4:07:07 pm] Sending request 'textDocument/semanticTokens/full - (407)'.
[Trace - 4:07:07 pm] Sending request 'textDocument/codeAction - (408)'.
[Trace - 4:07:07 pm] Received response 'textDocument/codeAction - (408)' in 180ms.
[Trace - 4:07:08 pm] Received response 'textDocument/semanticTokens/full - (407)' in 1087ms.
[Trace - 4:07:10 pm] Sending request 'textDocument/documentSymbol - (409)'.
[Trace - 4:07:11 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:11 pm] Sending request 'textDocument/linkedEditingRange - (410)'.
[Trace - 4:07:11 pm] Received response 'textDocument/linkedEditingRange - (410)' in 1ms.
[Trace - 4:07:11 pm] Sending request 'textDocument/codeAction - (411)'.
[Trace - 4:07:11 pm] Received response 'textDocument/codeAction - (411)' in 1ms.
[Trace - 4:07:11 pm] Sending request 'textDocument/semanticTokens/full - (412)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:12 pm] Sending request 'textDocument/documentColor - (413)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:12 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:12 pm] Received response 'textDocument/documentSymbol - (409)' in 2042ms.
[Trace - 4:07:12 pm] Sending request 'textDocument/codeAction - (414)'.
[Trace - 4:07:12 pm] Received response 'textDocument/semanticTokens/full - (412)' in 1119ms.
[Trace - 4:07:12 pm] Received response 'textDocument/codeAction - (414)' in 191ms.
[Trace - 4:07:13 pm] Sending request 'textDocument/linkedEditingRange - (415)'.
[Trace - 4:07:13 pm] Received response 'textDocument/linkedEditingRange - (415)' in 2ms.
[Trace - 4:07:13 pm] Received response 'textDocument/documentColor - (413)' in 1098ms.
[Trace - 4:07:13 pm] Sending request 'textDocument/linkedEditingRange - (416)'.
[Trace - 4:07:13 pm] Received response 'textDocument/linkedEditingRange - (416)' in 3ms.
[Trace - 4:07:13 pm] Sending request 'textDocument/codeAction - (417)'.
[Trace - 4:07:13 pm] Received response 'textDocument/codeAction - (417)' in 62ms.
[Trace - 4:07:14 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:14 pm] Sending request 'textDocument/completion - (418)'.
[Trace - 4:07:14 pm] Sending request 'textDocument/linkedEditingRange - (419)'.
[Trace - 4:07:14 pm] Sending request 'textDocument/codeAction - (420)'.
[Trace - 4:07:14 pm] Sending request 'textDocument/semanticTokens/full - (421)'.
[Trace - 4:07:14 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:14 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:14 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:14 pm] Sending request 'textDocument/linkedEditingRange - (422)'.
[Trace - 4:07:14 pm] Sending request 'textDocument/codeAction - (423)'.
[Trace - 4:07:14 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:14 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:15 pm] Sending request 'textDocument/documentColor - (424)'.
[Trace - 4:07:15 pm] Sending request 'textDocument/linkedEditingRange - (425)'.
[Trace - 4:07:15 pm] Sending request 'textDocument/codeAction - (426)'.
[Trace - 4:07:15 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:15 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:15 pm] Sending request 'textDocument/linkedEditingRange - (427)'.
[Trace - 4:07:15 pm] Sending request 'textDocument/codeAction - (428)'.
[Trace - 4:07:16 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:16 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:16 pm] Sending request 'textDocument/linkedEditingRange - (429)'.
[Trace - 4:07:16 pm] Sending request 'textDocument/codeAction - (430)'.
[Trace - 4:07:16 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:16 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:16 pm] Sending request 'textDocument/documentColor - (431)'.
[Trace - 4:07:16 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:16 pm] Sending request 'textDocument/linkedEditingRange - (432)'.
[Trace - 4:07:16 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:16 pm] Sending request 'textDocument/linkedEditingRange - (433)'.
[Trace - 4:07:17 pm] Sending request 'textDocument/codeAction - (434)'.
[Trace - 4:07:17 pm] Sending request 'textDocument/documentColor - (435)'.
[Trace - 4:07:17 pm] Received response 'textDocument/completion - (418)' in 3382ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:18 pm] Sending request 'textDocument/completion - (436)'.
[Trace - 4:07:18 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (419)' in 3718ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (420)' in 3708ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (422)' in 3224ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (423)' in 3179ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (425)' in 2961ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (426)' in 2896ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (427)' in 2497ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (428)' in 2442ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (429)' in 1899ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (430)' in 1852ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (432)' in 1374ms.
[Trace - 4:07:18 pm] Received response 'textDocument/linkedEditingRange - (433)' in 1142ms.
[Trace - 4:07:18 pm] Received response 'textDocument/codeAction - (434)' in 1092ms.
[Trace - 4:07:18 pm] Sending request 'textDocument/codeAction - (437)'.
[Trace - 4:07:21 pm] Received response 'textDocument/completion - (436)' in 3758ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:22 pm] Received response 'textDocument/documentColor - (424)' in 7055ms.
[Trace - 4:07:22 pm] Received response 'textDocument/documentColor - (431)' in 5700ms.
[Trace - 4:07:22 pm] Received response 'textDocument/documentColor - (435)' in 4662ms.
[Trace - 4:07:22 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:22 pm] Received response 'textDocument/codeAction - (437)' in 3592ms.
[Trace - 4:07:22 pm] Sending request 'completionItem/resolve - (438)'.
[Trace - 4:07:22 pm] Sending request 'textDocument/codeAction - (439)'.
[Trace - 4:07:22 pm] Received response 'completionItem/resolve - (438)' in 537ms.
[Trace - 4:07:22 pm] Received response 'textDocument/codeAction - (439)' in 231ms.
[Trace - 4:07:23 pm] Received response 'textDocument/semanticTokens/full - (421)' in 8792ms.
[Trace - 4:07:23 pm] Sending request 'textDocument/semanticTokens/full - (440)'.
[Trace - 4:07:24 pm] Sending request 'textDocument/documentSymbol - (441)'.
[Trace - 4:07:24 pm] Received response 'textDocument/semanticTokens/full - (440)' in 1157ms.
[Trace - 4:07:25 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:25 pm] Sending request 'textDocument/linkedEditingRange - (442)'.
[Trace - 4:07:25 pm] Received response 'textDocument/linkedEditingRange - (442)' in 4ms.
[Trace - 4:07:25 pm] Sending request 'textDocument/semanticTokens/full - (443)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:26 pm] Sending request 'textDocument/documentColor - (444)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:26 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:26 pm] Received response 'textDocument/semanticTokens/full - (443)' in 1324ms.
[Trace - 4:07:26 pm] Received response 'textDocument/documentSymbol - (441)' in 2304ms.
[Trace - 4:07:27 pm] Sending request 'textDocument/codeAction - (445)'.
[Trace - 4:07:27 pm] Received response 'textDocument/codeAction - (445)' in 81ms.
[Trace - 4:07:27 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:27 pm] Sending request 'textDocument/completion - (446)'.
[Trace - 4:07:27 pm] Received response 'textDocument/completion - (446)' in 38ms.
[Trace - 4:07:27 pm] Sending request 'textDocument/linkedEditingRange - (447)'.
[Trace - 4:07:27 pm] Received response 'textDocument/linkedEditingRange - (447)' in 2ms.
[Trace - 4:07:27 pm] Sending request 'textDocument/codeAction - (448)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:27 pm] Sending request 'textDocument/semanticTokens/full - (449)'.
[Trace - 4:07:28 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:28 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:28 pm] Sending request 'textDocument/documentColor - (450)'.
[Trace - 4:07:28 pm] Sending request 'textDocument/completion - (451)'.
[Trace - 4:07:28 pm] Sending request 'textDocument/linkedEditingRange - (452)'.
[Trace - 4:07:28 pm] Sending request 'textDocument/codeAction - (453)'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:28 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:28 pm] Sending notification '$/cancelRequest'.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
CompileError [ParseError]: Unexpected token
    at error (p:\macos\node_modules\svelte\compiler.js:17701:20)
    at Parser$1.error (p:\macos\node_modules\svelte\compiler.js:17777:10)
    at Parser$1.acorn_error (p:\macos\node_modules\svelte\compiler.js:17771:15)
    at read_expression (p:\macos\node_modules\svelte\compiler.js:8439:17)
    at mustache (p:\macos\node_modules\svelte\compiler.js:17449:29)
    at new Parser$1 (p:\macos\node_modules\svelte\compiler.js:17736:22)
    at parse$3 (p:\macos\node_modules\svelte\compiler.js:17868:21)
    at Object.compile (p:\macos\node_modules\svelte\compiler.js:31282:18)
    at SvelteDocument.getCompiledWith (c:\Users\devpu\.vscode\extensions\svelte.svelte-vscode-105.3.5\node_modules\svelte-language-server\dist\src\plugins\svelte\SvelteDocument.js:61:23)
    at async SvelteDocument.getCompiled (c:\Users\devpu\.vscode\extensions\svelte.svelte-vscode-105.3.5\node_modules\svelte-language-server\dist\src\plugins\svelte\SvelteDocument.js:55:34) {
  code: 'parse-error',
  start: { line: 112, column: 19, character: 3870 },
  end: { line: 112, column: 19, character: 3870 },
  pos: 3870,
  filename: undefined,
  frame: '110:       draggable="false"\r\n' +
    '111:     />\r\n' +
    '112:     {#if $openApps[]}\r\n' +
    '                        ^\n' +
    '113:       \r\n' +
    '114:     {/if}\r'
}
[Trace - 4:07:28 pm] Received response 'textDocument/codeAction - (448)' in 1186ms.
[Trace - 4:07:28 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:29 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:29 pm] Sending request 'textDocument/linkedEditingRange - (454)'.
[Trace - 4:07:29 pm] Sending request 'textDocument/codeAction - (455)'.
[Trace - 4:07:29 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:29 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:29 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:29 pm] Sending request 'textDocument/documentColor - (456)'.
[Trace - 4:07:30 pm] Sending request 'textDocument/linkedEditingRange - (457)'.
[Trace - 4:07:30 pm] Sending request 'textDocument/codeAction - (458)'.
[Trace - 4:07:30 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:30 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:30 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:30 pm] Sending request 'textDocument/linkedEditingRange - (459)'.
[Trace - 4:07:30 pm] Sending request 'textDocument/codeAction - (460)'.
[Trace - 4:07:30 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:30 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:30 pm] Sending request 'textDocument/completion - (461)'.
[Trace - 4:07:30 pm] Sending request 'textDocument/linkedEditingRange - (462)'.
[Trace - 4:07:30 pm] Sending request 'textDocument/codeAction - (463)'.
[Trace - 4:07:30 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:30 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:31 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:31 pm] Sending request 'textDocument/documentColor - (464)'.
[Trace - 4:07:31 pm] Sending request 'textDocument/linkedEditingRange - (465)'.
[Trace - 4:07:31 pm] Received response 'textDocument/completion - (451)' in 2717ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:31 pm] Sending request 'textDocument/codeAction - (466)'.
[Trace - 4:07:31 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:31 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:31 pm] Sending notification 'textDocument/didChange'.
[Trace - 4:07:31 pm] Received response 'textDocument/documentColor - (444)' in 5352ms.
[Trace - 4:07:31 pm] Received response 'textDocument/documentColor - (450)' in 3006ms.
[Trace - 4:07:31 pm] Received response 'textDocument/linkedEditingRange - (452)' in 2886ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:31 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:31 pm] Received response 'textDocument/codeAction - (453)' in 2890ms.
[Trace - 4:07:31 pm] Received response 'textDocument/linkedEditingRange - (454)' in 2429ms.
[Trace - 4:07:31 pm] Received response 'textDocument/codeAction - (455)' in 2387ms.
[Trace - 4:07:31 pm] Received response 'textDocument/linkedEditingRange - (457)' in 1611ms.
[Trace - 4:07:31 pm] Received response 'textDocument/codeAction - (458)' in 1567ms.
[Trace - 4:07:31 pm] Received response 'textDocument/linkedEditingRange - (459)' in 1275ms.
[Trace - 4:07:31 pm] Received response 'textDocument/codeAction - (460)' in 1245ms.
[Trace - 4:07:31 pm] Sending request 'textDocument/linkedEditingRange - (467)'.
[Trace - 4:07:31 pm] Sending request 'textDocument/codeAction - (468)'.
[Trace - 4:07:32 pm] Sending request 'textDocument/documentColor - (469)'.
[Trace - 4:07:33 pm] Received response 'textDocument/completion - (461)' in 3094ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:34 pm] Sending request 'completionItem/resolve - (470)'.
[Trace - 4:07:34 pm] Received response 'textDocument/linkedEditingRange - (462)' in 3325ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:34 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:34 pm] Received response 'textDocument/codeAction - (463)' in 3301ms.
[Trace - 4:07:34 pm] Received response 'textDocument/linkedEditingRange - (465)' in 2947ms.
[Trace - 4:07:34 pm] Received response 'textDocument/codeAction - (466)' in 2755ms.
[Trace - 4:07:34 pm] Received response 'textDocument/linkedEditingRange - (467)' in 2485ms.
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
Using Svelte v3.42.1 from p:\macos\node_modules\svelte\compiler
[Trace - 4:07:34 pm] Sending request 'textDocument/codeAction - (471)'.
[Trace - 4:07:34 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:34 pm] Received response 'textDocument/codeAction - (468)' in 2739ms.
[Trace - 4:07:34 pm] Sending notification '$/cancelRequest'.
[Trace - 4:07:34 pm] Received response 'completionItem/resolve - (470)' in 834ms.
[Trace - 4:07:34 pm] Received response 'textDocument/codeAction - (471)' in 506ms.
[Trace - 4:07:35 pm] Received notification 'textDocument/publishDiagnostics'.
[Trace - 4:07:35 pm] Received response 'textDocument/documentColor - (456)' in 5257ms.
[Trace - 4:07:35 pm] Received response 'textDocument/documentColor - (464)' in 4010ms.
[Trace - 4:07:35 pm] Sending request 'textDocument/linkedEditingRange - (472)'.
[Trace - 4:07:35 pm] Received response 'textDocument/linkedEditingRange - (472)' in 3ms.
[Trace - 4:07:35 pm] Sending request 'textDocument/codeAction - (473)'.
[Trace - 4:07:35 pm] Received response 'textDocument/codeAction - (473)' in 48ms.
[Trace - 4:07:35 pm] Received response 'textDocument/documentColor - (469)' in 3277ms.
[Trace - 4:07:36 pm] Received response 'textDocument/semanticTokens/full - (449)' in 8613ms.
[Trace - 4:07:36 pm] Sending request 'textDocument/semanticTokens/full - (474)'.
[Trace - 4:07:37 pm] Sending request 'textDocument/linkedEditingRange - (475)'.
[Trace - 4:07:37 pm] Received response 'textDocument/linkedEditingRange - (475)' in 3ms.
[Trace - 4:07:37 pm] Sending request 'textDocument/codeAction - (476)'.
[Trace - 4:07:37 pm] Received response 'textDocument/codeAction - (476)' in 4ms.
[Trace - 4:07:37 pm] Received response 'textDocument/semanticTokens/full - (474)' in 1205ms.
[Trace - 4:07:39 pm] Sending request 'textDocument/documentSymbol - (477)'.
[Trace - 4:07:39 pm] Sending request 'textDocument/linkedEditingRange - (478)'.
[Trace - 4:07:39 pm] Received response 'textDocument/linkedEditingRange - (478)' in 3ms.
[Trace - 4:07:39 pm] Sending request 'textDocument/codeAction - (479)'.
[Trace - 4:07:39 pm] Received response 'textDocument/codeAction - (479)' in 4ms.
[Trace - 4:07:40 pm] Sending request 'textDocument/linkedEditingRange - (480)'.
[Trace - 4:07:40 pm] Received response 'textDocument/linkedEditingRange - (480)' in 2ms.
[Trace - 4:07:40 pm] Sending request 'textDocument/codeAction - (481)'.
[Trace - 4:07:40 pm] Received response 'textDocument/codeAction - (481)' in 21ms.
[Trace - 4:07:40 pm] Received response 'textDocument/documentSymbol - (477)' in 1039ms.
[Trace - 4:07:40 pm] Sending request 'textDocument/codeAction - (482)'.
[Trace - 4:07:40 pm] Received response 'textDocument/codeAction - (482)' in 40ms.
[Trace - 4:07:41 pm] Sending request 'textDocument/linkedEditingRange - (483)'.
[Trace - 4:07:41 pm] Received response 'textDocument/linkedEditingRange - (483)' in 2ms.
[Trace - 4:07:41 pm] Sending request 'textDocument/codeAction - (484)'.
[Trace - 4:07:41 pm] Received response 'textDocument/codeAction - (484)' in 20ms.

@naeil
Copy link

naeil commented Aug 26, 2021

my case

/svelte/lib/documents/configLoader.ts:77
const pathResults = this.globSync("**/svelte.config.{js,cjs,mjs}", { cwd: directory, ignore: "node_modules/**", });
<< is very slow over 7 sec

i chage it "fast-glob"
const pathResults = fastglob.sync(["**/svelte.config.{js,cjs,mjs}"], { cwd: directory, ignore: ["**/node_modules/**"], });
<< is 0.1 sec

@PuruVJ
Copy link
Author

PuruVJ commented Aug 27, 2021

@dummdidumm
Copy link
Member

my case

/svelte/lib/documents/configLoader.ts:77
const pathResults = this.globSync("**/svelte.config.{js,cjs,mjs}", { cwd: directory, ignore: "node_modules/**", });
<< is very slow over 7 sec

i chage it "fast-glob"
const pathResults = fastglob.sync(["**/svelte.config.{js,cjs,mjs}"], { cwd: directory, ignore: ["**/node_modules/**"], });
<< is 0.1 sec

Interesting find. The ignore patterns are not the same though, and this also should only affect startup performance. Does this affect other tasks for you, too?
How fast is it if you keep the library but change the ignore pattern?
const pathResults = this.globSync("**/svelte.config.{js,cjs,mjs}", { cwd: directory, ignore: "**/node_modules/**", });

@naeil
Copy link

naeil commented Aug 27, 2021

import glob from "glob";
import fastglob from "fast-glob";

let s = Date.now();
let result = glob.sync("**/package.json", {
    cwd: "c:/dev/sos/core",
    ignore: "node_modules/**",
});
console.log("glob node_modules/**", result.length, Date.now() - s);

s = Date.now();
result = glob.sync("**/package.json", {
    cwd: "c:/dev/sos/core",
    ignore: "**/node_modules/**",
});
console.log("glob **/node_modules/**", result.length, Date.now() - s);

s = Date.now();
result = fastglob.sync("**/package.json", {
    cwd: "c:/dev/sos/core",
    ignore: ["node_modules/**"],
});
console.log("fastglob node_modules/**", result.length, Date.now() - s);

s = Date.now();
result = fastglob.sync("**/package.json", {
    cwd: "c:/dev/sos/core",
    ignore: ["**/node_modules/**"],
});
console.log("fastglob **/node_modules/**", result.length, Date.now() - s);

result

glob node_modules/** 1461 27880
glob **/node_modules/** 151 19174
fastglob node_modules/** 1461 908
fastglob **/node_modules/** 151 462

@PuruVJ
Copy link
Author

PuruVJ commented Aug 27, 2021

If this can work, the perf improvements to the extension would be tremendous 😱

@dummdidumm
Copy link
Member

This certainly seems to improve performance, but these things are only related to startup time, not when coding afterwards.

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Aug 30, 2021
Also relax ignore pattern. Should result in faster startup times.
sveltejs#1139
dummdidumm added a commit that referenced this issue Aug 30, 2021
Also relax ignore pattern. Should result in faster startup times.
#1139
@ignatiusmb
Copy link
Member

There's also fdir which claims to be the fastest directory crawler & globbing library, haven't tested it myself but the benchmarks are pretty impressive, worth a try if fast-glob is still isn't enough.

@dummdidumm
Copy link
Member

The newest VS Code extension (version 105.9.0) contains a performance improvement which should make global auto completions significantly faster, which should increase the overall responsiveness of the extension. Please provide feedback if it's better now.

@dummdidumm dummdidumm removed the bug Something isn't working label Jan 10, 2022
@dummdidumm dummdidumm added the perf Performance label Jan 10, 2022
@PuruVJ
Copy link
Author

PuruVJ commented Jan 10, 2022

Whoa, awesome!

I'm on one of the new M1 Pro MacBooks, and hence, it has been blazing fast as ever. I don't see any difference on the mac after the latest release. I can't test on the original machine cuz I don't have it anymore 🥲

So, really sorry, I can't provide conclusive feedback

@dummdidumm
Copy link
Member

Thanks for the feedback nevertheless! Since noone else commented on this issue with performance issues who could provide more feedback, I'm going to close this.

@MrWaip
Copy link

MrWaip commented Apr 5, 2024

I don't know, but maybe I'm there talking about the same #2329 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf Performance
Projects
None yet
Development

No branches or pull requests

5 participants