language-tools: Significant lag and performance degradation in VSCode with Volar on

Issue Type: Bug

This issue is a recent one, perhaps related to the recent update?

Extension version: 0.38.9 VS Code version: Code 1.69.1 (b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a, 2022-07-12T08:22:10.822Z) OS version: Darwin arm64 21.5.0 Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 8, 10, 10
Memory (System) 16.00GB (0.09GB free)
Process Argv –crash-reporter-id 2999e9bf-ef35-4154-bed3-74f44259cdaf
Screen Reader yes
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
pylanb8912:30529769
vsclangdf:30486550
841h4636:30531698

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 45 (16 by maintainers)

Commits related to this issue

Most upvoted comments

For peoples who still has performance issue with latest version, you can try:

  1. Disable javascript.suggest.autoImports and typescript.suggest.autoImports in workspace settings.
  2. Try enable volar.vueserver.useSecondServer in workspace settings for better performance, or disable it for less memory usage.
  3. Delete node_modules and check did problems gone or not. If yes, delete package.json dependencies / devDependencies one by one to see which package lead to problems. (If this is the reason, the package usually has lot of .d.ts files.)
  4. Try Takeover mode.
  5. (Advanced) Investigate (Performance Tracing)[https://github.com/microsoft/TypeScript-wiki/blob/main/Performance-Tracing.md] use vue-tsc.

Close this issue because do not have anymore helpful information, if you can confirm the performance from plugin, please open a new issue with append repro case or profiling record.

It’s too slow to use

I can confirm this on my system as well. It’s quite ridiculous waiting for insights take +5-10s and makes it impossible to get insights with any sort of speed.

再现个鬼, 你开个2000行左右的vue文件,插件提示直接歇菜,慢得一批~!换回vuter后,一切正常~!

Okay, this looks like your first issue, how about to take a look at what others are doing? I think we all know disabling extension to avoid it couldn’t help anything, so why not do something more meaningful, like try and see if something like this happens to you? 😃

再现个鬼, 你开个2000行左右的vue文件,插件提示直接歇菜,慢得一批~!换回vuter后,一切正常~!

WebStorm now also uses Volar and it takes almost 9 seconds for the error to disappear. Deleting node_modules and package-lock.json didn’t fixed the issue.

https://github.com/vuejs/language-tools/assets/6358971/e8bb548b-2cc5-44f5-b3bd-37792adfc794

What helps is switching Volar with the TypeScript Service. I could try to create some repository where you could reproduce it, but I don’t want to share it publicly here. Also I can’t guarantee it will reproduce in VSCode.

The current version of Volar does not have much overhead, but its performance is limited by TypeScript. If your project itself is a huge TypeScript project, TypeScript LanguageService will analyze it slowly anyway. If you can provide a repro case, I might be able to help find out the performance hotspots in your project. It may come from a certain dependency, or some recursive type. At least the performance problems I have checked recently are all from the project itself.

If you need help please provide a repro case and open a new issue, I’ll find time to check it, otherwise I can’t help, I’m not a magician.

Removing

"editor.codeActionsOnSave": ["source.organizeImports"]

from my global settings, did the trick. Hope it helps.

@Noxdor I try mitigate memory leak by https://github.com/johnsoncodehk/volar/commit/7337d1c1fef9f51c70387e9352e7e4914800ea2d, please try v0.40.3.

Thanks for the reply! As I wrote above, for me the issue was already resolved and I am right now on 0.40.1. So it can’t have been the changes in 0.40.3. Unfortunately I can’t pinpoint it any more precisely.

@onurusluca Sorry just typo, I mean v0.39.2 released later than this issue open.

@johnsoncodehk Thanks a lot for the reply. Sorry for not specifying the problem. I chose v0.38.5 because the next update from that has a longer gap.

I am testing all the versions now. It is taking a bit of a time. I will write here as soon as I am done testing.

Also great job with the extension. I love Volar!

@onurusluca Thank for the information, is this problem begin in v0.38.6?

v0.38.5 ~ v0.38.6 only have one commit and it should be unrelated, so I’m out of ideas for now.

I still can’t reproduce this performance issue, I may need someone try with each commit after v0.38.5 and let me know which commit cause the problem.

I can also confirm this. It suddenly got slow. I uninstalled VsCode and it’s settings, cleaned cached, did general cleaning but still slow.

@brys0 Please let me know if this version have difference or not: volar-0.39.5-alpha.1.vsix.zip

Tried this one but it is the same. Thanks for your time though. Hope this gets solved.

For now I downgraded to v0.38.5 and syntax highlighting got much faster just like before.

I figured it may have been an issue with typescript trying to work with 2 different versions. Lovely you found the issue, thanks for taking your personal time to fix it. Much love 🤍

I’ve removed every extension did a fresh install of vscode and just installed Volar and it’s still just as slow. I have no idea what might be happening, based on what you said it could be related to certain node modules? Such as @vicons libraries causing Volar to scan the entire module which has upwards of 300+ vue files. Any advice for other people is I would consider somehow removing intelisense on large node modules like naive-ui and any icon library that directly uses .vue files.

  • (If this is a recent issue) Which version did this issue start appearing?
  • Do you have update typescript version? And what’s is your typescript version? (See status bar when opened .vue file)
  • Can this problem alleviate by setting "javascript.suggest.autoImports": false and "typescript.suggest.autoImports": false in VSCode?

Okay, I’ll try to change these settings to test when I get back to work next week; I suspect the lag may be related to some of the node processes not being closed properly, which may take some time to occur with use, so it’s not immediately reproducible.