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.

Sometimes Vetur is still very slow

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

Info

  • Platform: Windows
  • Vetur version: 0.26.1
  • VS Code version: 1.48.1

Problem

I’ve seen related issues like https://github.com/vuejs/vetur/issues/1272 talking about calls to synchronizeHostData. I did not dig in too much, but I found that when validating sources and templates, calls such as getSemanticDiagnostics may call synchronizeHostData internally (link), and by a rudimentary profiling it looks like each validation will took ~300ms on my computer. When I’m writing code, js and template will be validated separately, so they might take something like 500 or 600ms in total. I’m not sure if that’s the cause of the issue since I didn’t do an accurate profiling, but probably it will help. https://github.com/vuejs/vetur/blob/53ee52746b1f26f44391c3764bc7bd06d4ddaa46/server/src/modes/template/interpolationMode.ts#L72 https://github.com/vuejs/vetur/blob/2e32351514b01f3bec9478c0e55217e21b88d8ae/server/src/modes/script/javascript.ts#L118

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
Eurkiducommented, Oct 14, 2020

Hi @yoyo930021 Thank you so much

I tried #2332 and #2328 before The performance problem is better than at the beginning, but it is still very slow. I closed vetur.validation.interpolation and vetur.languageFatures.codeAction because of work later. After closing these two items, the performance is not so bad

I read your latest reply the day before yesterday. I understand that this problem is probably related to typescript sourceFile version. Then I merged #2328 and #2374 locally and used it for a while, and also opened the previously closed vetur. .validation.interpolation and vetur.languageFatures.codeAction

After 2 days of use, I found that this is really great, everything has become very normal, I don’t need to restart vscode again after I work a day, I think the problem is probably solved, and there is basically no physical feeling the performance drops over time

However, I still have a little confusion. When I perform batch file replacement, even if I only replace a comment globally, in the case of about 28 files, the replacement needs to be executed for about 15s, about 500ms for each file, depending on the status The column prompt is that vscode is formatting each file. Is this effect normal, but after the file batch replacement is completed, it will not slow down the overall operation as before. This is perfect.

I will continue to test my local version, but I think the problem is probably solved. I hope that if there is no problem in the test, #2374 can be merged as soon as possible @octref

7reactions
yoyo930021commented, Oct 11, 2020

I’ve found out why it’s slow when using typescript template service and borken https://github.com/vuejs/vetur/issues/2192#issuecomment-699864856. vetur.experimental.templateInterpolationService: true.

The synchronizeHostData function will check up to date with isProgramUptoDate function. https://github.com/microsoft/TypeScript/blob/c88e44a9e65f7d7a72ef72c9dfae94ef0fcb6bb0/src/services/services.ts#L1307

It check sourceFileNotUptoDate with using sourceFile version property equal to host.getScriptVersion(sourceFile.fileName) result . https://github.com/microsoft/TypeScript/blob/c88e44a9e65f7d7a72ef72c9dfae94ef0fcb6bb0/src/compiler/program.ts#L579

When template sourceFile, The sourceFile get version property undefined. Because we create new sourceFile when generated template code, and missing version, scriptSnapshot properties in language service sourceFile. https://github.com/vuejs/vetur/blob/a7331253140367075e841268bbcc3a2b06ec04df/server/src/services/typescriptService/preprocess.ts#L118

I fix this problem in #2374.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ | Vetur - GitHub Pages
Vetur is slow​​ You can run the command Vetur: Restart VLS (Vue Language Server) to restart VLS. However, we'd appreciate it if you...
Read more >
How to fix Vetur taking forever to save a file
There is a known bug in Vetur, the Vue VSCode extension, where it takes forever (sometimes several minutes!) to lint Vue files on...
Read more >
VS Code Vetur initialization is extremely slow - Stack Overflow
I am experiencing extremely slow Vetur initialisation after every time VS code is restarted. It helps a bit if I don't npm run...
Read more >
jsconfig.json Reference - Visual Studio Code
Tip: If you are not using JavaScript, you do not need to worry about ... If IntelliSense is slow, add folders to your...
Read more >
Popular VS Code Extensions for Vue.js & Nuxt.js Developers
She was coding in JavaScript, sometimes in TypeScript, ... Are there still cases when you want to use Vetur instead of Volar?
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