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

Extension causes huge typing latency spikes #321

Open
Valloric opened this issue Nov 10, 2019 · 5 comments
Open

Extension causes huge typing latency spikes #321

Valloric opened this issue Nov 10, 2019 · 5 comments

Comments

@Valloric
Copy link

Repro steps:

  1. My entire vscode config is here. vscode_setup.sh can install all the extensions I use.
  2. VS Code version info included below.
  3. Open this file.
  4. Make sure spellright is enabled and the en_US dictionary (default from Debian) is loaded.
  5. Start typing gibberish inside the license header (comment) at the top of the file. Gibberish is important to trigger spelling mistakes for every word.
  6. Observe huge typing latency before even hitting the 80th column.

I can observe CPU usage climbs to +90% as well during step 5 above. This is on a workstation machine using a beefy Intel Core i5-8600K CPU @ 3.60GHz.

Disabling only this extension removes all typing latency. Typing gibberish outside of a comment region (where spell checking is disabled) shows latency spikes during typing.

If it's hard to nail down what's causing this (and even if it's not), I'd appreciate an option that delays spell checking until the user has stopped typing for 100ms (or more). This would prevent the extension from interfering with character input. I don't need spell check to run after every character typed and I doubt anyone else needs it either.

VS Code version info:
Version: 1.40.0
Commit: 86405ea23e3937316009fc27c9361deee66ffbf5
Date: 2019-11-06T18:14:08.920Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 4.19.0-5-amd64

@Valloric
Copy link
Author

Interestingly, disabling every extension except this one does not lead to the input latency spike on gibberish but it does still lead to 100% CPU usage. My guess is that while this extension is doing something suboptimal, things get even worse when it interacts with one of my other extensions.

I used the command below.

code --disable-extension bbenoist.togglehs \
--disable-extension  DavidAnson.vscode-markdownlint \
--disable-extension  foxundermoon.shell-format \
 --disable-extension Gruntfuggly.todo-tree \
 --disable-extension  llvm-vs-code-extensions.vscode-clangd \
  --disable-extension mrcrowl.hg \
  --disable-extension ms-python.python \
  --disable-extension richie5um2.vscode-sort-json \
  --disable-extension rust-lang.rust \
  --disable-extension vscode-icons-team.vscode-icons \
  --disable-extension vscodevim.vim .

@Valloric
Copy link
Author

Valloric commented Nov 10, 2019

My intuition was correct: this extension pairs badly with the Vim emulation extension. Note that VS Code Vim is an incredibly popular extension.

I ran the same experiment with this command:

code --disable-extension bbenoist.togglehs \
--disable-extension  DavidAnson.vscode-markdownlint \
--disable-extension  foxundermoon.shell-format \
 --disable-extension Gruntfuggly.todo-tree \
 --disable-extension  llvm-vs-code-extensions.vscode-clangd \
  --disable-extension mrcrowl.hg \
  --disable-extension ms-python.python \
  --disable-extension richie5um2.vscode-sort-json \
  --disable-extension rust-lang.rust \
  --disable-extension vscode-icons-team.vscode-icons \

That disables everything except VS Code Vim and spellright. I could repro the input latency spike.

@bartosz-antosik
Copy link
Owner

Thank you for thorough investigation. This issue is somehow known to me (#1) and it has been mitigated a bit since then but still the only way to fight it properly is, I presume, delegate the extension to Language Server. It has been partially done alas, I have very little time recently to deal with the extension.

@ogmios-voice
Copy link

ogmios-voice commented Jan 23, 2020

huge typing latency before even hitting the 80th column

All of this means that the spell checking itself is very slow. I'm also affected by this problem, and based on the very high CPU usage, it seems to me more like a brute force search instead of a (fast) map based solution (I haven't checked the code, so I don't know for sure).
What algorithm is the spell checking based on?

@majkinetor
Copy link

Yeah, its very slow.

I have one file in which copy/paste lasts 10s each time. I have never seen this behavior in vscode on any other place, its disturbing - there is a loader after you CTRL+V! I had to exclude this file in settings. Its not a big file, just a 500 lines of links like this:

links.md

image

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

No branches or pull requests

4 participants