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

After upgrade to MacOS Monterey, vscode unusable, extremely slow rendering #136260

Closed
zajo opened this issue Nov 2, 2021 · 52 comments · Fixed by #143223
Closed

After upgrade to MacOS Monterey, vscode unusable, extremely slow rendering #136260

zajo opened this issue Nov 2, 2021 · 52 comments · Fixed by #143223
Assignees
Labels
chromium Issues and items related to Chromium fixed-in-electron-16 Issues fixed with Electron 16.x update gpu Issues concerning GPU related items insiders-released Patch has been released in VS Code Insiders macos-monterey upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro
Milestone

Comments

@zajo
Copy link

zajo commented Nov 2, 2021

First, thank you for the great IDE.

My vscode window spans two external monitors. After installing MacOS Monterey, vscode is able to draw about 2 frames per second (it works fine on the laptop display).

Any suggestions on adjusting rendering options?

Version: 1.61.2
Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643
Date: 2021-10-19T15:49:28.381Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 21.1.0

about

@ShubhamVerma1811
Copy link

ShubhamVerma1811 commented Nov 2, 2021

Experiencing the same lag on Mac Monterey

Tried by disabling all extension.
Still happening.

@deepak1556 deepak1556 added chromium Issues and items related to Chromium confirmation-pending gpu Issues concerning GPU related items macos-monterey upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Nov 2, 2021
@deepak1556
Copy link
Collaborator

Can you attach the following data points to further debug the issue, thanks!

  1. Does the issue happen when you launch with --use-cmd-decoder=passthrough
  2. Does the issue happen when you launch with --disable-gpu
  3. Can you provide the output of code --verbose
  4. Can you provide the output of system_profiler SPDisplaysDataType

@deepak1556 deepak1556 added the info-needed Issue requires more information from poster label Nov 2, 2021
@ShubhamVerma1811
Copy link

ShubhamVerma1811 commented Nov 2, 2021

Hey @deepak1556 ,
Tried the steps.

  1. The cli says this doing code --use-cmd-decoder=passthrough. The LAG still happens
    Warning: 'use-cmd-decoder' is not in the list of known options, but still passed to Electron/Chromium.
  2. The lag still happens, tried scroll through lines and switching b/w files.
  3. verbose.txt
  4. sysprof.txt with no ext monitor
    EDIT: Logs with ext monitor attached, and performance profile logs
  5. sysprofwithexternalmonitor.txt with ext monitors
  6. VSCODE LAG Monterey Profile.json.zip

@deepak1556
Copy link
Collaborator

Can you also attach the profile following these steps https://github.com/microsoft/vscode/wiki/Performance-Issues#visual-studio-code-is-sluggish

@zajo
Copy link
Author

zajo commented Nov 3, 2021

Thank you for looking into this. I can confirm that neither of --disable-gpu or --use-cmd-decoder=passthrough fixes anything.

@zajo
Copy link
Author

zajo commented Nov 3, 2021

Another bit of information: the lag seems to grow significantly with the number of vscode windows open, even when they are fully covered by the top-most vscode window. With 7 open vscode windows, even menus are sluggish, the menu selection is updated something like once every 4 seconds (!) on my laptop. Minimizing all but one window makes the menus completely responsive, but the rest (editor scrolling) is still very slow.

@deepak1556
Copy link
Collaborator

@zajo can you also attach the output of system_profiler SPDisplaysDataType. @ShubhamVerma1811 setup does not seem to have an external monitor and you have mentioned originally that the problem does not repro with external monitors disconnected. So looks like there are two different issues here, I don't have a multi-monitor setup but asked my colleague to check on this and they were not able to repro with a single external monitor. So very likely issue is associated with the type of display and gpu driver.

Additionally @zajo can you also attach the profile following the steps below,

1) Start the app like

code --enable-gpu-service-tracing --enable-tracing="blink,cc,gpu,renderer.scheduler,sequence_manager,v8,toplevel,viz,disabled-by-default-viz.overdraw" --trace-startup-file="/tmp/vscode_slow_trace.log"

2) Perform all the steps to repro the slowdown
3) Quit the application (Cmd + Q)
3) Log file `vscode_slow_trace.log` will be generated inside `/tmp`

@ShubhamVerma1811
Copy link

ShubhamVerma1811 commented Nov 3, 2021

I do have a external monitor, but I didn't have it connected when gathered the logs.

For me the issue happens with and without external monitor.

I could re gather the logs with external monitor connected.

Edit: I have added the logs with external monitor in my earlier comment

@deepak1556
Copy link
Collaborator

deepak1556 commented Nov 3, 2021

@ShubhamVerma1811 thanks for confirming, can you test if the slowdown happens when you use the application only from the external monitor. Also it would be helpful to get a trace from your setup based on the steps outlined here #136260 (comment)

@ShubhamVerma1811
Copy link

Hey @deepak1556 ,
Sorry for the delayed reply.
I tried to just use vscode in external monitor, the slowness still occurs.
Here is the vscode_slow_trace.log
vscode_slow_trace.log.zip

@deepak1556 deepak1556 removed the info-needed Issue requires more information from poster label Nov 4, 2021
@deepak1556
Copy link
Collaborator

Thanks for the log, first highlight is there is aggressive gpu flushing via GLContext::FlushForDriverCrashWorkaround, this was added via https://bugs.chromium.org/p/chromium/issues/detail?id=906453 to avoid trigger bug in certain gpu drivers. Couple of things to check based on this,

  1. How is the perf when you start with code --disable-oop-rasterization
  2. When you use https://vscode.dev on chrome or edge on the same machine, do you see similar perf regression ?
  3. Quick check on which gpu is problematic, can you try code --force_high_performance_gpu and code --force_low_power_gpu to see if there is a difference.

@zajo
Copy link
Author

zajo commented Nov 5, 2021

@deepak1556 I followed your steps but after quitting there was no /tmp/vscode_slow_trace.log. In Terminal I got:

Warning: 'enable-gpu-service-tracing' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'enable-tracing' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'trace-startup-file' is not in the list of known options, but still passed to Electron/Chromium.

Just in case I tried generating a log in the home directory, also no output.

@ShubhamVerma1811
Copy link

Followed steps from here - #136260 (comment)

  • Slowness happened on vscode.dev
  • Tried with force_high_performance_gpu and force_low_power_gpu flags, Slowness still happened.
  • And I got the same warning in terminal like Zajo menitioned above.

@deepak1556
Copy link
Collaborator

@zajo thanks for trying the debug steps, you can ignore those warnings. The file might take a couple of seconds to generate depending on the active time of the application. Can you ensure there was no code process running after you quit the app.

@ShubhamVerma1811 thanks for testing

Slowness happened on vscode.dev

As a next step here, can you help open an issue with chromium https://bugs.chromium.org/p/chromium/issues/list using https://vscode.dev as an example. The issue should now be addressed in the runtime.

How is the perf when you start with code --disable-oop-rasterization

Did you also try this ?

@deepak1556 deepak1556 added upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro and removed confirmation-pending labels Nov 5, 2021
@ShubhamVerma1811
Copy link

Yes, I did try with disable-oop-rasterization,
The slowness still happened.

You want me to open this issue in bugs .chromium?
Is that right?

@zajo
Copy link
Author

zajo commented Nov 6, 2021

@deepak1556 I'm pretty sure there was no process running (the indicator on the icon in the MacOS dock went off). It is possible that something didn't work correctly because vcode was running extremely slowly, menu selection moved at 0.5 frames per second (it takes two seconds for the menu selection to follow the mouse cursor).

@mattfysh
Copy link

mattfysh commented Nov 7, 2021

I've also noticed performance tank after upgrading to Monterey, most noticeable when selecting text. Clicking and dragging feels slow & unresponsive, and sometimes when hitting cmd+a to select all, it can take a second or two.

It's especially noticeable with template literals in JS

I've also tried disabling all extensions but still noticed a slowdown

@deepak1556
Copy link
Collaborator

@ShubhamVerma1811 yes, also please use running https://vscode.dev on chrome browser as the repro scenario when filing the issue as it will be easier for the developers to triage it faster.

@ShubhamVerma1811
Copy link

ShubhamVerma1811 commented Nov 8, 2021

@deepak1556 and everyone here,
I was in the process of opening bug in chromium, and I noticed one thing in VSCcode while testing..

Try this thing,
Remove everything from your settings.json file and make it {}. Doing thing is not causing the slowness.
Both vscode.dev and native VSCode are now working fast like before.

So I believe some property of some extension is causing this effect. I need to perform trial and error to get the extact extension.

EDIT:
I might have found the property, it is
editor.renderWhitespace.
It is set to all, then lag would occur
If it is not set, then lag would occur on selection as mentioned by @mattfysh.

So in your settings.json add this "editor.renderWhitespace": "none".
Now I think the lag should go away.

Having editor.renderWhitespace:all only had the slowness effect on chrome and edge.Safari and Firefox didn't lag.

Although this is just a temporary fix because people like me really what that option to be set to "all".

@steida
Copy link

steida commented Nov 8, 2021

I have the same problem, tried everything mentioned without success.

@jscheel
Copy link

jscheel commented Jan 28, 2022

I've filed an issue here: https://bugs.chromium.org/p/chromium/issues/detail?id=1291590

@deepak1556
Copy link
Collaborator

@zajo sorry for the delay on getting back to this thread, can you test our exploration build based on a newer runtime version and see if the lag continues. Thanks!

macOS universal download

@zajo
Copy link
Author

zajo commented Feb 7, 2022

@deepak1556 Thanks! I think I have some useful information for you, though we're in the unfortunate situation that my configuration has changed since I reported the original issue: previously I was using multiple external monitors, and now I'm using a single 4K external monitor. Another difference is that I've upgraded to the newest macOS Monterey 12.2.

With this changed setup, vscode worked well for weeks until I downloaded this latest update today:

Version: 1.64.0
Commit: 5554b12acf27056905806867f251c859323ff7e9
Date: 2022-02-03T04:20:17.224Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 21.3.0

And now it's very slow again, although probably for a different reason, since the original problem was gone when I switched to one external monitor. I have multiple vscode windows open (which I need, and was not a problem before the today's update), I get this in Activity Monitor:

Screen Shot 2022-02-06 at 16 00 22

The good news is that the exploration build you attached does not have this problem. Also, I downgraded to the previous vscode version, and I can confirm it worked fine (in my newer simplified configuration).

If you want me to run more experiments, let me know.

@deepak1556
Copy link
Collaborator

@zajo insiders has now been updated to same runtime version as exploration. Can you check if the issue is now present with it, thanks!

@zajo
Copy link
Author

zajo commented Feb 11, 2022

It's good. I guess we should close the issue now, even though we don't know if it's fixed on my setup when I reported it originally.

@NorthernMan54
Copy link

@deepak1556 This is good as well. I was also suffering from sluggish behaviour on my dual monitor setup, but it was only triggered after running my selenium/chromedriver test scripts. Or that was when I had noticed it. Installing the insiders version resolved it.

I was also experiencing Electron crashes as well, and these are resolved as well.

@deepak1556
Copy link
Collaborator

Closing based on insiders testing, thanks for self-hosting with the build!

@deepak1556 deepak1556 added the fixed-in-electron-16 Issues fixed with Electron 16.x update label Feb 18, 2022
@deepak1556 deepak1556 added this to the February 2022 milestone Feb 18, 2022
@im0qianqian
Copy link

Hello, I've been paying attention to this issue recently.
Thank you very much for the temporary solution provided by @ShubhamVerma1811, which makes me no longer suffer from slow trouble. But after my test today, I found that my problem may have something to do with the font setting. Here is my condensed version of settings.json.

{
    "editor.fontFamily": "YaHei Consolas Hybrid, monospace",
    "editor.renderWhitespace": "all",
}
  • When I set editor.renderWhitespace: none, there will be no slow problem.
  • When I remove YaHei Consolas Hybrid from editor.fontFamily, there also will be no slow problem.

I tried to use YaHei Consolas Hybrid font in the vscode insider version, and set editor.renderWhitespace: all, but the slow will still exist.
I hope this can provide you with some information.

YaHei_Consolas_Hybrid_1.12.ttf.zip

@deepak1556
Copy link
Collaborator

@im0qianqian thanks for the repro, I can confirm the issue. I have updated #111816 with your test case, can you follow that issue for updates, thanks!

@jscheel
Copy link

jscheel commented Feb 18, 2022

I'd like to come back to my earlier comments about slowdowns in typing happening across the board. I have specifically traced a huge typing slowdown to aggressive frequency throttling that macOS Monterey is now doing when on the integrated gpu. This is a measurable slowdown that makes typing in vscode (and chrome, and basically anything else) almost impossible. I have to completely disable the intel gpu and rely on the discrete card to even type on my device now.

@akhilmhdh
Copy link

Hey there. Thank you so much for finding the culprit. I was having this issue quite a while after upgrade.

editor.renderWhitespace: none did save me. ❤️

@deepak1556 deepak1556 modified the milestones: February 2022, March 2022 Feb 24, 2022
@deepak1556 deepak1556 reopened this Feb 24, 2022
@deepak1556
Copy link
Collaborator

Runtime version has been reverted for February milestone #143851

@NorthernMan54
Copy link

I have updated my vscode-insiders release to the latest, and the problem has returned. I had been using the older version from about 4 weeks ago without issue. Based on this being closed I had assumed that insiders had been updated, or do I need to wait for next insiders release ?

Version: 1.66.0-insider
Commit: 6b7453421201c888b81eae5c04ec822a6423608f
Date: 2022-03-11T05:16:52.815Z
Electron: 17.1.1
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin x64 21.3.0

@Kamlesh502
Copy link

changing the editor.fontFamily solved my issue

@zajo
Copy link
Author

zajo commented Mar 25, 2022

Please reopen, it's broken again after upgrading to macOS Monterey 12.3, see image.

screenshot

The excessive CPU usage persist even after all vscode windows are minimized.

Visual Studio Code info:

Version: 1.65.2
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Date: 2022-03-10T14:33:49.188Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 21.4.0

@deepak1556
Copy link
Collaborator

@zajo the fix has not yet made into the stable release, it will be available in 1.66. Can you check if the issue persists with https://code.visualstudio.com/insiders ?

@zajo
Copy link
Author

zajo commented Mar 25, 2022

I'd rather wait for the 1.66 release, if you don't mind. I have a suspicion that this may in the end turn out to be a temporary thing, when I originally opened this issue it also was after a OS version update -- is it possible that the new OS is doing some system-specific optimizations that interfere somehow with vscode?

@zajo
Copy link
Author

zajo commented Mar 29, 2022

My theory seems to be correct: after the MacOS upgrade, for two days vscode was having this issue. Now the issue is gone, without rebooting the OS and without even restarting vscode. As to what's causing it, who knows, maybe the new OS is reindexing files, maybe it's optimizing something, and maybe that interferes somehow with vscode. I hope this info helps.

@pedaars
Copy link

pedaars commented Mar 30, 2022

I have tried the latest insiders build and the lag is the same for me

@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
chromium Issues and items related to Chromium fixed-in-electron-16 Issues fixed with Electron 16.x update gpu Issues concerning GPU related items insiders-released Patch has been released in VS Code Insiders macos-monterey upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-pending Issues that are caused by chromium but have not been reported due to pending minimal repro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

14 participants