vscode
vscode copied to clipboard
High CPU usage while typing (plain text)
Issue Type: Performance Issue
Quick typing causes noticeable high CPU usage even in case of plain text w/o any extension. The larger the file the more visible, but it's already happens w/ an empty file.
Steps:
- create a new plain text document w/ e.g. 50k lines of:
The quick brown fox jumps over the lazy dog.
- in a new line press and keep pressing any letter (= simulate quick typing)
- in a few seconds CPU usage will jump up (regardless of the word wrap setting)
VS Code version: Code - Insiders 1.65.0-insider (bb221a61d29deabd99ee9431736d04f2175cb596, 2022-02-11T05:19:13.554Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2600) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Screen Reader | no |
VM | 0% |
Process Info
CPU % Mem MB PID Process
0 106 16392 code-insiders main
0 43 7540 utility-network-service
0 129 13004 gpu-process
0 236 13188 extensionHost
0 80 7032 "R:\VSCode-win32-x64-1.65.0-insider\Code - Insiders.exe" --ms-enable-electron-run-as-node r:\VSCode-win32-x64-1.65.0-insider\resources\app\extensions\css-language-features\server\dist\node\cssServerMain --node-ipc --clientProcessId=13188
0 25 13464 crashpad-handler
0 353 13864 window (a.txt - Visual Studio Code - Insiders)
1 85 18828 issue-reporter
0 100 21816 shared-process
0 74 14764 ptyHost
0 74 18348 fileWatcher
Workspace Info
;
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30422396
pythontb:30258533
pythonvspyt551cf:30291413
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
pythonvspyt200:30323110
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
wslgetstartedc:30421358
vsclayoutctrt:30405800
dsvsc009:30436273
pythonvsnew555cf:30426299
vsbas813:30436447
vscscmwlcmc:30428972
azactmsalcf:30432849
vscgsvid1:30433757
@ogmios-voice I've done a CPU profile while keeping Enter pressed but I could not spot anything problematic. A typical handling of a keypress takes <2ms and rendering also takes 5-6ms which looks normal:

Could you please try to create a CPU profile and share it here?
Could you please retry while keeping e.g. a
pressed? (This was my original test, and I also think Enter
would trigger some other behaviour.) If it is still not visible, I'll create a CPU profile.
I see this as well. I disabled all extensions and restarted vscode but the same behaviour remains. It's not just adding characters either, deleting text 1 character at a time causes the same issue.
VSCode info
Item | Value |
---|---|
Version | 1.64.2 (user setup) |
Commit | f80445acd5a3dadef24aa209168452a3d97cc326 |
Date | 2022-02-09T22:02:28.252Z |
Electron | 13.5.2 |
Chromium | 91.0.4472.164 |
Node.js | 14.16.0 |
V8 | 9.1.269.39-electron.0 |
OS | Windows_NT x64 10.0.19043 |
I'm on AMD (Ryzen 9 5950X 16-Core Processor @ 3.40 GHz) and typing causes heavy usage across a number of cores. So much so that the system fans all spin up and the cpu temp spikes from 40 to 70 degrees C.
In this image I started typing at the green line and stopped at the blue line:
@ogmios-voice @Russ-K Can you please attach CPU profiles? I am happy to take a look and see if there's something we can improve.
@alexdima CPU profile attached...
CPU-20220224T085833.885Z.cpuprofile.txt
Thanks for looking into it
It also seems to happen when switching between different files in the same project.
CPU profile for switching files attached...
Hey @alexdima, this issue might need further attention.
@ogmios-voice, you can help us out by closing this issue if the problem no longer exists, or adding more information.
I can confirm this is still an issue.
VSCode info
Item | Value |
---|---|
Version | 1.67.1 (user setup) |
Commit | da15b6fd3ef856477bf6f4fb29ba1b7af717770d |
Date | 2022-05-06T12:37:03.389Z |
Electron | 17.4.1 |
Chromium | 98.0.4758.141 |
Node.js | 16.13.0 |
V8 | 9.8.177.13-electron.0 |
OS | Windows_NT x64 10.0.19043 |
Also having the same issue, but on Linux. Didn't manage to get the CPU Profile report.
Version: 1.67.1 Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d Date: 2022-05-06T12:39:22.915Z Electron: 17.4.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Linux x64 5.11.0-49-generic
System Info
- Code: 1.67.1 (da15b6fd3ef856477bf6f4fb29ba1b7af717770d)
- OS: linux(5.11.0-49-generic)
- CPUs: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz(8 x 3499)
- Memory(System): 19.34 GB(11.96GB free)
- Memory(Process): 286.16 MB working set(158.02MB private, 26.62MB shared)
- VM(likelihood): 0%
- Initial Startup: true
- Has 0 other windows
- Screen Reader Active: false
- Empty Workspace: false
Note: I dual boot win11 and Ubuntu, this only happens in the ubuntu version, same version of vs code runs smoothly on windows.
UPDATE: Issue has been solved after VS Code updated to version 1.67.2
On windows it is still present in v1.67.2. The CPU usage increase is visible also in the Performance monitor of Developer Tools.
But I can also see in Task Manager / Process Explorer most likely another Code.exe
thread running at 90-100%... Is there a way to monitor all the threads from VSCode?
same here
same
I opened the vscode process manager and found that the problem was eslint.
Hey @alexdima, this issue might need further attention.
@ogmios-voice, you can help us out by closing this issue if the problem no longer exists, or adding more information.
This no longer appears to be an issue on the latest version. This is with various extensions enabled as well (ESLint, Prettier, GitLens, indent-rainbow)
VSCode info
Item | Value |
---|---|
Version | 1.70.2 (user setup) |
Commit | e4503b30fc78200f846c62cf8091b76ff5547662 |
Date | 2022-08-16T05:35:13.448Z |
Electron | 18.3.5 |
Chromium | 100.0.4896.160 |
Node.js | 16.13.2 |
V8 | 10.0.139.17-electron.0 |
OS | Windows_NT x64 10.0.19043 |
I do have some extensions running but I have this exact problem. I'm version 1.73.1 (Mac - Monterey v12.6). Minimal CPU usage on idle, but as soon as I start typing, it goes up to 90%+ and vscode becomes laggy.
@Russ-K I think things have improved here due to an Electron update, perhaps with the Electron 18 update from June, because the CPU profiles you attached did not contain a lot of time spent in JS, but contained time spent in "(program)" which might indicate time spent in the native part of the renderer process.
@seunggs Could you please create a separate issue? I think this might have been a problem specific to Electron on Windows.
@ogmios-voice Are you still experiencing this issue? Can you please attach a CPU profile?
@alexdima - I'm not on Windows. I was on Mac - Monterey v12.6 but now I'm on Ventura v13.0.1 and still observing the same behavior. I think my issue is related to typescript.
@seunggs Yes, it would be best to create a separate issue. Then, I can guide you through troubleshooting steps. Thanks!
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!