microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.14k stars 29.28k forks source link

VSCode becomes laggy after using it for some time (macOS Ventura) #165016

Open franktzheng opened 2 years ago

franktzheng commented 2 years ago

Type: Performance Issue

Hi! I upgraded to the macOS Ventura beta a few months ago (which was probably a mistake), and I've had problems with VSCode being laggy ever since. I primarily use VSCode to compile LaTeX, but I've run into this issue while using it with TypeScript before (so it doesn't seem to be related to a particular extension). The problem I'm experiencing is similar to what might happen if there is a memory leak. When I first open the app, everything is fine, and I experience no lag whatsoever. However, after writing code for maybe 15-30 minutes, I typing and highlighting code becomes pretty laggy. If I restart the application (quit and reopen), things return to normal. I'm sorry I can't provide much more information, and I doubt I'd be able to reproduce this problem on someone else's computer.

VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:16:30.254Z) OS version: Darwin x64 22.2.0 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (1.50GB free)| |Process Argv|--crash-reporter-id 919a54c2-c935-41b4-956b-39224562195e| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 102 164 21312 code main 2 66 21316 gpu-process 0 16 21318 utility-network-service 0 295 21319 window (hw2.tex — math-215a) 0 98 21326 extensionHost 0 82 21337 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/frankzheng/.vscode/extensions/james-yu.latex-workshop-8.29.0/out/src/components/parser/syntax_worker.js 0 33 21338 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/frankzheng/.vscode/extensions/james-yu.latex-workshop-8.29.0/out/src/providers/preview/mathjaxpool_worker.js 0 115 21328 shared-process 0 33 21329 ptyHost 0 0 21349 /bin/zsh -il 0 33 21339 fileWatcher 0 0 29166 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 49 21342 window (undefined) 0 213 21345 window (undefined) 10 66 29163 issue-reporter ```
Workspace Info ``` | Window (hw2.tex — math-215a) | Folder (math-215a): 20 files | File types: aux(2) fdb_latexmk(2) fls(2) log(2) out(2) pdf(2) gz(2) | tex(2) sty(2) DS_Store(1) | Conf files:; ```
Extensions (15) Extension|Author (truncated)|Version ---|---|--- vsc-material-theme|Equ|33.5.0 vsc-material-theme-icons|equ|2.4.0 prettier-vscode|esb|9.9.0 reasonml|fre|1.0.38 latex-workshop|Jam|8.29.0 python|ms-|2022.16.1 vscode-pylance|ms-|2022.10.40 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 remote-ssh|ms-|0.90.1 remote-ssh-edit|ms-|0.84.0 cpptools|ms-|1.12.4 material-icon-theme|PKi|4.21.0 intellicode-api-usage-examples|Vis|0.2.6 material-theme|zhu|3.15.6 (3 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 pyindex848:30577860 nodejswelcome1cf:30587006 fc301958:30595537 2e4cg342:30596373 ```
LukeForeverYoung commented 2 years ago

I met the similar problem. I notice there several processes called "Code Helper" cost up to 99% CPU. Does this phenomenon happen in your machine? btw, i'm using mac Monterey and the version of vscode is 1.72.

p-iknow commented 2 years ago

I met the similar problem. Too. version: Version: 1.72.2

xavierdonnellon commented 2 years ago

Me too. It’s ridiculously slow, almost unusable suddenly. I can’t even type a line of code in real time, it falls behind my typing by a couple of seconds.

I see loads of Code Helper processes (see attachment), I don’t know if this is normal.

image

I’m on macOS Ventura 13.1 beta on VS code 1.73.0

jonny-harte commented 2 years ago

Similar issue for me. VS Code (1.73.0) is noticeably slower and has crashed several times since upgrading to MacOS Ventura (not beta).

rzhao271 commented 2 years ago

Does disabling the extensions.experimental.useUtilityProcess setting help?

xavierdonnellon commented 2 years ago

It is already disabled.

NeitoFR commented 2 years ago

Same behaviour here on 1.73 (Ventura 13.0). Example : pwd output instantly but it takes more than 10 second to get control back on terminal

ryanpassage commented 2 years ago

I am seeing similar performance issues on macOS 13.0 (Intel-based Macs). Code usually runs fine for a while (varies, but it's been a couple of hours today) and then performance drops off a cliff. In particular I have observed high CPU usage for the Code Renderer process and have, a few times, seen a "Discarding backups is taking longer than expected" type message when attempting to quit Code. If I leave it alone and don't force quit, it eventually does close the window and quit the process. Performance is back to normal when I launch the app again.

Hope this information helps.

naivefun commented 1 year ago

Same here. Updated to Ventura and suddenly everything becomes slow. The prettier format is particularly painful.

image
moffatman commented 1 year ago

I have a profile example here, what's interesting is that during profiling it becomes a lot more responsive.

image
LukeForeverYoung commented 1 year ago

By updating the extension Pylance to preview version, the laggy issue seems to have disappeared. But I am not so sure that the extension causes the issue.

xavierdonnellon commented 1 year ago

This definitely needs to be addressed. I have to restart VS Code every few minutes. FYI: When the extreme lag comes, I disabled all extensions and did not change the lag.

deepak1556 commented 1 year ago

For those still facing the issue, can you provide the following profiles when the lag happens.

1) Take a sample of the Code process from the OS activity monitor Sample process menu action. 2) Open developer tools inside VSCode using Developer: Toggle Developer Tools command and from the performance tab record a profile for few seconds and perform actions that would demonstrate the lag.

moffatman commented 1 year ago

I see this in Chrome itself as well recently. So it may not be VSCode's problem. Sample of Code.txt https://files.catbox.moe/gfld8x.json

adrihle commented 1 year ago

The same happen to me for a v1.73.1 and Ventura 13.0.1

xavierdonnellon commented 1 year ago

This is still a big problem!

Here is the Activity Monitor Sample Process: Code sample.txt

Here is my Developer tools profile: https://drive.google.com/file/d/1U1i985B2EDgb_20OPzYAh8dR-IWDPIws/view?usp=sharing

CPU usage of Code jumps to 100% during autocomplete making text input ridiculously laggy (after using application for about 30 minutes).

isAlmogK commented 1 year ago

I just upgraded and having the same issue.

VS Code Version: 1.74.0 Commit: 5235c6bb189b60b01b1f49062f4ffa42384f8c91 Date: 2022-12-05T16:43:37.594Z (3 days ago) Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 22.1.0 Sandboxed: No

Mac

Screenshot 2022-12-09 at 6 12 38 PM
tony-brookes commented 1 year ago

I also have massive issues since upgrading to Ventura. I waiting until the official release but VSCode is basically unusable since the upgrade. What seems to be happening is that after a while (not that long, a few minutes usually) the extension hosts simply stop responding, completely. So no matter what you are doing, they just don't respond. Restart a Jupyter kernel... nope, the next thing you try to do will sit there with an icon on it that looks like the Time Machine icon on the Mac, but it will do nothing, at all, even if you leave it for hours. Want to open a file using the palette. Nope, that will sit there searching and will never ever find the file you know is there. Want to use a linter? Not a prayer...

I'm not sure what is going on but there seems to be little to no consideration for Mac users on VSCode in recent releases. Ventura betas have been out for months and bugs have been filed about performance on Ventura since that happened but no one has done anything as far as I can tell. Trying to debug myself is a non starter because if I google for "debug vscode" I get a ton of articles on how to debug WITH vscode but now how to debug the program itself. It's a shame because I've always really liked VS Code, but I have work to do and I can't wait for them to "get around" to looking at this, so I guess I will have to look for more a more reliable editor... Like Eclipse. :)

moffatman commented 1 year ago

I have this issue in Google Chrome as well. So something wrong in chromium I suppose. Restarting every 3-4 days is a reliable solution though.

xavierdonnellon commented 1 year ago

Yes, makes VS code truly unusable, and doesn’t seem to be getting the right attention!

tony-brookes commented 1 year ago

It's definitely much worse as soon as I start to use things like Python extensions. I've been using it to edit TypeScript for the last few days and it's fine, but when I get back to needing to do some Python work it just stops working reliably. I can't even create a file or rename a file without it taking forever once I've opened a Python file. I've cleared out everything, deleted all my local preference files and done a clean reinstall but it just comes back. Frustrating is not the word!

tony-brookes commented 1 year ago

Is anyone looking at this from the VSCode team?

TimHuynh0905 commented 1 year ago

Hi guys, I face the same issue using Vscode (the latest version) and macOS Ventura 13.0.1. vscode has become super laggy. One thing I noticed though is when I use vscode with an external monitor, the issue disappears. Not sure if anyone noticed/ had the same problem.

lucianomasuero commented 1 year ago

Same issue on MacOS Ventura 13.1 and VSCode 1.74.2 CodeHelper process takes a lot of % CPU and VSCode is really slow

@TimHuynh0905 Im also using external monitor and issue still bothering

cgervais commented 1 year ago

+1 on the issue of Code Helper (GPU) using a lot of CPU (ironic!). I've also noticed that process remains after VSCode quits running around 99% CPU utilization, so I've been manually going into Activity Monitor to kill the process. Which is fun.

I'm on Ventura 13.1 and VSCode 1.74.3 on a 14-inch MacBook Pro M1 Max 32GB RAM

ReDrUm commented 1 year ago

+1 I just went from MacOS 12 to 13.1 today and sadly VSCode is unexpectedly destroying my CPU and making it unusable while it remains open. Apple M1 Pro 32GB:

Version: 1.74.3 (Universal)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T17:07:18.579Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.2.0
Sandboxed: No
lucianomasuero commented 1 year ago

Just in case... I fixed (or think that fixed) by disabling Plugins. Using Bisect

xavierdonnellon commented 1 year ago

macOS Software Update fixed it for me a few days ago. Miracle

Geokureli commented 1 year ago

I'm having lag issues after upgrading to ventura as well, however my issue is solely typing, even moving the cursor with arrow keys is instant, so I'll get weird things where if I hit space,right,space, it will move the cursor right, and add 2 spaces. it sometimes takes up to 4-5 seconds to insert a single character, but usually it will delay and then enter every key that was pressed at once

I'm not seeing anything crazy in my activity monitor, so perhaps this is a different issue?

tamuratak commented 1 year ago

@Geokureli

You should try to find extensions causing issues with bisect at first.

Geokureli commented 1 year ago

You should try to find extensions causing issues with bisect at first.

Thanks, this was the issue

chanakya-svt commented 1 year ago

You should try to find extensions causing issues with bisect at first.

Thanks, this was the issue

@Geokureli What is the extension(s) that's causing the issue on your side?

Geokureli commented 1 year ago

@chanakya-svt https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-checkstyle

sholatunji commented 1 year ago

Same problem, VSC becoming unusable

Visual Studio - 17.5.1(build 23) MacOS - Ventura 13.2.1

chanakya-svt commented 1 year ago

I used the bisect for the extensions and found that https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer extension is causing the issue. Once disabled VSC is good but still a bit laggy after long usage. I had to restart the VSC once a day to make it usable.

mtrin commented 1 year ago

My case, bisect wasn't showing any issue with extensions, vscode itself was loading really slow before extensions were loaded. I then removed the app and installed again but using brew cask and it loaded fast again.

mariomeissner commented 1 year ago

Started experiencing lag today. Last thing I did was adding plugins to prettier (tailwindcss sort and trivago import sort), while using the prettier extension. Typing becomes laggy.

Disabling the prettier extension removes the lag.

ddobrinskiy commented 1 year ago

@deepak1556 I'm also experiencing this issue, mostly when working on python repos.

image

Attaching the 2 files that you requested:

Sample of Code.txt

Performance Profile from developer tools

AnshulRaghav commented 1 year ago

Check if resource-hungry software like ADOBE not running in BG. For me, that was the root cause but I was cursing Microsoft and Apple.

nneverlander commented 1 year ago

this was my issue too

Roseidon commented 1 year ago

Our issue was a dependency that had some performance issues, even leading to VSCode bevoming laggy.

So don't forget to upgrade your dependencies 😁

hitzhangjie commented 1 year ago

I'm also experiencing this issue. I'm working on a monorepo which have many protocolbuffer files and *.pb.go, and other RPC stub. After several hours, vscode becomes slow. Goland has no this problem.

Polyhistor commented 1 year ago

Even after bisect, still things are really slow for me.

SpiritusDeos commented 1 year ago

Same issue here, working also on a monorepo running with turborepo (6 middle size projects)

RhetTbull commented 1 year ago

VSCode had been working fine on Ventura for me but recently, multiple Code Helper (Plug In) processes have started using 100% CPU intermittently slowing VSCode to a crawl. I assume these are related to plugins I have installed (none have changed since before the problem manifested) but it's impossible to tell if the processes are associated with a specific plugin.

macOS: 13.5.1 (Intel) VSCode: Version: 1.81.1 (Universal) Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794 Date: 2023-08-09T22:20:33.924Z Electron: 22.3.18 ElectronBuildId: 22689846 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin x64 22.6.0

Plugins installed:

adpyke.vscode-sql-formatter
alefragnani.Bookmarks
amazonwebservices.aws-toolkit-vscode
ara225.regex-copy-or-cut
DavidAnson.vscode-markdownlint
donjayamanne.python-environment-manager
eamodio.gitlens
foxundermoon.shell-format
GitHub.copilot
GitHub.copilot-chat
github.vscode-github-actions
idleberg.applescript
jmviz.quote-list
MAKinteract.micro-bit-python
mechatroner.rainbow-csv
ms-python.isort
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-slideshow
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
ms-vscode.hexeditor
ms-vscode.live-server
ms-vscode.remote-explorer
ms-vscode.remote-server
njpwerner.autodocstring
redhat.vscode-yaml
ryanluker.vscode-coverage-gutters
sdras.night-owl
softwaredotcom.swdc-vscode
sourcery.sourcery
streetsidesoftware.code-spell-checker
tamasfe.even-better-toml
twxs.cmake
Tyriar.sort-lines
VisualStudioExptTeam.intellicode-api-usage-examples
VisualStudioExptTeam.vscodeintellicode
vscodevim.vim
dereknovak commented 1 year ago

I've been having this issue for several days now. A couple things that I have noticed:

  1. The lag seems to involve a user input. When the lag starts, I can either press a key or click mouse and it will resume.
  2. When I record my VSCode session (via Start Extensions Host Profile), the problem magically disappears. Once I stop the recording, it resumes.

I am running MacOS Ventura 13.5.2 and have no VSCode extensions enabled

jlandrum commented 1 year ago

I'm curious if this is something within WebKit and Blink that are causing a common issue - partially due to Blink being a fork of WebKit.

I am having this issue within a Storybook instance in Safari and Edge that prior to updating, was not causing issues. Firefox doesn't have these issues. Both feel like they slow down about the same time, and terminating Safari temporarily fixes Storybook while terminating VSCode temporarily fixes the sluggishness there.

Both also get EXTREMELY slow when navigating the DOM tree, sometimes causing the window to blank and flicker.

I can't possibly think what it would be other than maybe some memory integrity features in the OS. Apple also has added quite a bit of privacy and security into Ventura but I don't expect those things to impact Blink or WebKit directly.

I also have had no luck trying to profile VSCode - doing so will cause it to lock up, and interestingly enough, the same occurs trying to do the same with Storybook.

Could be a red herring and just a coincidence but maybe not - it's the only problem at all I've had with Ventura to date.

clayheaton commented 1 year ago

I never had this issue before upgrading to Sonoma. Unfortunately, the memory usage balloons to > 12 Gb in under a minute, making VS Code unusable for development work.

I'm on an M1 MBA with 8Gb of RAM.

Version: 1.83.1 Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc Date: 2023-10-10T23:57:32.750Z Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin arm64 23.0.0

Screenshot 2023-10-14 at 5 35 58 PM

Sample of Code Helper (Renderer).txt

NRubin613 commented 7 months ago

Any updates on this issue? I'm still experiencing extreme lag after extended use.

kirilsvoloshins commented 7 months ago

same issue with occasional couple seconds long stutters + slow response on typing

32 GB M1 Macbook Pro macOS: Ventura 13.5.1 VSCode Version: 1.87.2 (Universal)

image