question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Perf issue] Autocomplete is still slow

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.19.4
  • VS Code version: 1.33.1
  • Typescript version: 3.2.4
  • Use class style component
  • Number of vue files: 71
  • Number of ts files: 115
  • Number of dependencies in package.json: 50

Problem

Autocomplete is still slow in class style component, I guess my project is just a medium size project.

[Trace - 00:05:00] Received response 'textDocument/documentLink - (163)' in 6970ms.
[Trace - 00:05:00] Received response 'textDocument/documentColor - (164)' in 6971ms.
[Trace - 00:05:00] Sending request 'textDocument/codeAction - (171)'.
[Trace - 00:05:00] Sending notification '$/cancelRequest'.
[Trace - 00:05:01] Received response 'textDocument/codeAction - (165)' in 8395ms.
[Trace - 00:05:01] Received notification 'textDocument/publishDiagnostics'.
[Trace - 00:05:02] Sending request 'textDocument/codeAction - (172)'.
[Trace - 00:05:02] Sending notification '$/cancelRequest'.
[Trace - 00:05:02] Received response 'textDocument/codeAction - (166)' in 7747ms.
[Trace - 00:05:02] Received response 'textDocument/codeAction - (167)' in 7144ms.
[Trace - 00:05:03] Received response 'completionItem/resolve - (168)' in 7358ms.
[Trace - 00:05:03] Received response 'textDocument/codeAction - (169)' in 7086ms.
[Trace - 00:05:04] Received response 'textDocument/codeAction - (170)' in 5819ms.
[Trace - 00:05:04] Received response 'textDocument/codeAction - (171)' in 4366ms.
[Trace - 00:05:05] Received response 'textDocument/codeAction - (172)' in 3401ms.

Here is the profile CPU-20190503T235912.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
tohkinzhucommented, May 4, 2019

me too…If i use typescript in .vue file. But it’s fast in .ts file. I found that the more ts files, the slower the speed…(200+ .ts files in my project) There is no such problem with webstorm

5reactions
NoahStahlcommented, May 5, 2019

I spent some time debugging the extension code today and noticed a few things. I stepped through code while watching performance counters to isolate lines that cause the observed I/O spikes. So far, I think the performance impact is coming from interaction with the TS language server in ways that cause it to scan the entire project for all TS-related files. One example is this line:

https://github.com/vuejs/vetur/blob/7fa2ead6831f22beaf6dd0ec87ed888a1c7ed65f/server/src/modes/script/javascript.ts#L605

Every keystroke causes many of these calls, each of which causes a scan of the entire project file system (thousands of reads each time). Caching that result and reusing if possible would reduce the IO, rather than repeating every time.

Another way this seems to happen is any time the TS language server runs its createProgram function, which likewise scans and parses all TS files. This would be any function call into the TS service, like:

https://github.com/vuejs/vetur/blob/7fa2ead6831f22beaf6dd0ec87ed888a1c7ed65f/server/src/modes/script/javascript.ts#L147

Those calls result in createProgram invocations internally that generate lots of IO.

I came across some discussion that might be related, where caching the TS server instance data somehow is suggested as a workaround:

https://github.com/typescript-eslint/typescript-eslint/issues/243

Hope the helps. It’s my first time in the code, so if I’m off I apologize.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript auto complete performance issue - Stack Overflow
If the webservice is slow you can still make it instant after the first char is typed. For example and this depends on...
Read more >
Input auto complete or drop down performance issue
Hi There. I need to load 1500+ user names (Format: Name (Userid) )into either Input with auto complete or dropdown (using select2 widget)....
Read more >
Episerver Find autocomplete slow - Optimizely World
Hi All,. We have a very basic service setup to search and return the top 5 items from our Find index: [HttpGet] [AllowAnonymous]...
Read more >
Reference Fields (2 of 4) Autocomplete Wait Time - ServiceNow
The issue comes in when these requests are frequent enough and/or slow enough to start causing performance issues.
Read more >
How to Fix Input Lag and Slow Performance in Google Chrome
You might be experiencing slow performance issues with Chrome because it needs to be updated. Within Chrome, go to Settings window and click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found