microsoft / vscode

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

Terminal draws are taking very long on some environments #36913

Closed ghost closed 6 years ago

ghost commented 6 years ago
Extension Author (truncated) Version
vscode-devdocs akf 1.0.1
project-manager ale 0.22.0
vscode-intelephense-client bme 0.7.2
npm-intellisense chr 1.3.0
laravel-goto-view cod 1.1.2
bracket-pair-colorizer Coe 0.10.10
gitlens eam 5.7.1
php-debug fel 1.11.1
auto-close-tag for 0.5.2
auto-rename-tag for 0.0.14
vscode-import-formatter hen 0.1.8
composer ika 0.5.0
vscode-php-snippets jar 0.0.9
php-namespace-resolver Meh 0.8.0
code-beautifier mic 1.7.2
vscode-todo-parser min 1.9.1
vs-deploy mkl 10.0.0
azure-account ms- 0.1.3
php-docblocker nei 1.3.2
laravel-blade one 1.9.0
laravel5-snippets one 1.3.4
vscode-docker Pet 0.0.20
material-icon-theme PKi 2.2.3
gi rub 0.2.11
laravel-artisan rya 0.0.8
highlight-matching-tag vin 0.4.4
vscode-wakatime Wak 1.1.18
vscode-todo-highlight way 0.5.11
vscode-import-cost wix 2.5.1

(1 theme extensions excluded)


Steps to Reproduce:

  1. Hit the carat to maximize the terminal

    maximizeterminal
  2. VSCode then becomes very slow.

Reproduces without extensions: (disabling extensions improves performance, but it is still "slow")

Tyriar commented 6 years ago

@jm-mwi what's in your settings.json file? Do you have a particularly small font size and/or window.zoomLevel?

eterevsky commented 6 years ago

@Tyriar, I also ran into the same problem. It seems to have started only in 1.17, though it might have resulted from some unrelated changes in my configuration.

Version: 1.17.2 Relevant settings:

{
  "editor.fontFamily": "Fira Code Retina",
  "editor.fontLigatures": true,
  "editor.fontSize": 15,
  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
  "window.zoomLevel": 0,
  "workbench.activityBar.visible": false,
}

My monitor resolution is 3840x2160 and system-wide scaling is 150%.

Reproduction steps:

  1. Disable all the extensions and close all editor tabs.
  2. Maximize the window by pressing F11.
  3. Open terminal and maximize its pane.
  4. Run cat some_file.txt to fill up 200-500 lines on the terminal.
  5. At this point most actions in the Terminal are extremely slow, in particular:
    • Typed letters appear with a noticeable delay.
    • Scrolling the terminal window with a mouse wheel hangs the system. None of vscode UI is responsible, the mouse pointer moves in jerks, "The window is no longer responsible" system alert may or may not appear. Pressing Ctrl-Alt-Del to open Task Manager works with a delay of several seconds.

In Task Manager I see that VSCode process taking ~1 CPU core and System process taking from 1 to 2 cores.

I also ran into a similar though less severe issue on Linux, with the similar settings of VSCode, and monitor 2560x1600.

eterevsky commented 6 years ago

A couple of additional observations:

Tyriar commented 6 years ago

@eterevsky do you know if GPU acceleration is disabled somehow? For example do you use --disable-gpu to work around some other issue?

eterevsky commented 6 years ago

@Tyriar, no I haven't disabled GPU acceleration.

Attaching a screenshot of the profiler in Developer Tool.

vscode-screenshot

ghost commented 6 years ago

@Tyriar, here are my settings as it relates to text...

{
    "workbench.iconTheme": "material-icon-theme",
    "editor.lineHeight": 24,
    "editor.fontSize": 15,
    "editor.fontFamily": "Hasklig, Monoid, Fira Code",
    "editor.fontLigatures": true,
    "editor.minimap.enabled": true,
    "editor.minimap.maxColumn": 200,
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "editor.minimap.showSlider": "always",
    "window.zoomLevel": 1,
    "editor.minimap.renderCharacters": false
}
Tyriar commented 6 years ago

@eterevsky thanks for the screenshot :smiley: something about your environment is drawing from ImageBitmaps very slowly. What OS/version are you on?

eterevsky commented 6 years ago

@Tyriar It's an up-to-date 64-bit Windows 10. VSCode version: 1.17.2. Later today I can try to connect a Macbook to a 4K monitor, to see whether it's reproducible on another OS.

I don't experience any slowness in the editor panes, it's specific to the terminal.

Tyriar commented 6 years ago

All related reports for this problem seem to be on Windows 10.

eterevsky commented 6 years ago

All related reports for this problem seem to be on Windows 10.

Yep. Tried to reproduce on macOS, but everything worked smoothly.

If you point me to a 1.16 installer, I can check, whether it's a new bug in 1.17.

Tyriar commented 6 years ago

@eterevsky no need, it's new with these changes: https://code.visualstudio.com/blogs/2017/10/03/terminal-renderer

franklin-ross commented 6 years ago

Just dropping my 2 cents in here to say I seem to have the same issue. I've got a couple of Webpack builds, and one of them seems to cause this reasonably often. Everything locks up for a few seconds, on and off, especially when scrolling. I too am running windows 10 64-bit with VSCode 1.17.2.

I profiled while it was happening. Here's a lil' screenshot of what I guess is causing it, and I can provide the profiler file too, but it's a cool 33meg.

image

franklin-ross commented 6 years ago

I've noticed this only seems to happen on my high DPI laptop. If VSCode is open on the same laptop, but displaying on a 1920x1080 screen, I no longer seem to have any issues.

eterevsky commented 6 years ago

Hi! Is there any update on this issue? For me it makes VSCode terminal completely unusable in my preferred workflow, and I have to use external terminals, even though I really like the idea of a console in a VSCode pane.

Tyriar commented 6 years ago

@eterevsky I'm still not sure what the root cause is unfortunately.

I have had reports of slow drawing when the terminal has certain styling, particularly when most of the terminal has a different background color or is using true color. Is anyone's terminal doing this during the slow down? (see https://github.com/zeit/hyper/issues/2592)

zeroepoch commented 6 years ago

I'm using Ubuntu 16.04 x86_64 and I'm seeing the same problem with 1.20.1. I also have a 4k HiDPI display with 125% font scaling. Done by the DE for the menus and stuff. Other font sizes (maybe due to another bugs) is done for the terminal and editor through prefs.

"editor.fontFamily": "Inconsolata",
"editor.fontSize": 15,
"terminal.integrated.fontSize": 15,

When the terminal windows is not maximized it works perfectly fine. If I un-maximize it performance returns to normal. I can toggle back and forth between maximized and normal and the perf issue comes and goes between states as described.

anovix commented 6 years ago

Same for me as for @zeroepoch . I am on Ubuntu 17.10. Desktop gnome 3.26.2. VSCode 1.20.1. Terminal becomes very slow when I maximaze it. After I unmaximzed it is working perfectly. My laptop display has 4k resolution (3840x2160) and at 200% scale. Hope my info helps.

thernstig commented 6 years ago

@Tyriar Any progress on this?

eterevsky commented 6 years ago

@Tyriar Exactly the same issue happens on Linux. VSCode 1.21. Here's a screenshot of the profiler:

screenshot from 2018-03-14 15-08-13

It's a pity, since I really like VSCode terminal, and this bug makes it unusable for me both on Windows and on Linux.

Tyriar commented 6 years ago

@eterevsky do you experience the issue on the same machine on Windows/Linux with dual booting by chance? Can you provide details on your GPU?

eterevsky commented 6 years ago

@Tyriar Those are two different computers. The Windows machine has nVidia GTX 1080, the Linux machine has nVidia Quadro K620.

Tyriar commented 6 years ago

@eterevsky and you're not setting --disable-gpu when you launch code right?

eterevsky commented 6 years ago

@Tyriar Nope, I do not pass any special options. You actually already asked that here :)

Tyriar commented 6 years ago

@eterevsky opps, too many notifications 😛.

Could you try reproduce when launching with this?

code --ignore-gpu-blacklist --enable-accelerated-2d-canvas --enable-gpu-rasterization --enable-native-gpu-memory-buffers
eterevsky commented 6 years ago

@Tyriar Sorry for the delay. I tried it on my Linux machine, and it worked in exactly the same way as before, i.e. very slow.

It's also reproducible when the terminal is split (a new VSCode feature). It's also reproducible when the window is not completely maximized, but still fills most of the screen.

It does not happen when the terminal covers less than ~1/3 or ~1/4 of the screen space. If seems that there is a certain threshold of the number of characters or pixels: while the terminal is below this threshold it works completely fine, and once past this threshold it chokes for seconds after each character or line.

franklin-ross commented 6 years ago

Just want to chime in again to say that @eterevsky s comments are very consistent with my experience on windows too. There does seem to be a threshold at about a quarter or third of the screen space were the issue first appears, and it mostly only presents on my high DPI screen so my guess is it's more about pixels them characters. It also doesn't seem as bad if the side bar is open, which one again reduces the actual screen space being drawn to by the terminal.

I tried to reproduce the issue in the xtermjs demo on Chrome the other day to see whether it would also choke when drawing lots of characters in a large terminal; but I couldn't seem to get it to maximise properly, even with their full screen plugin. It looked full screen, but would only actually draw characters to the same small section. I could have another go if that seems like it could be helpful, or if someone with more experience with xterm could help me set up in a similar way to how vscode uses it.

Tyriar commented 6 years ago

@franklin-ross in the xterm.js demo you can increase the size of the viewport by setting the cols and rows in the textboxes at the bottom.

franklin-ross commented 6 years ago

I see. Thanks @Tyriar, I'll give it another go this long weekend and see what comes out of it.

Tyriar commented 6 years ago

I created https://github.com/Microsoft/vscode/issues/46954 to provide a fallback when canvas GPU acceleration is turned off.

dkent600 commented 6 years ago

When running as code --disable-gpu the problem for me goes away. I have a 4K monitor.

Tyriar commented 6 years ago

I was able to repro by stretching across 2 1080p monitors and maximizing the panel

image

image

It's very interesting that the experience is much better with GPU support disabled.

image

Tyriar commented 6 years ago

Ok I have some good news, I cannot reproduce this slowness on our build that's on Electron v2/Windows 10 which will likely hit stable in v1.23. It would be great if I could get some people to verify those who have been experiencing the issue. Here's the build https://az764295.vo.msecnd.net/exploration/3ff48e575e04e31a0e4645656c18f43047444bad/VSCode-win32-x64-1.23.0-exploration.zip

Something else that puts more weird behind this thinking is that I can't reproduce the slowness when I run the terminal under Chrome 65.

dkent600 commented 6 years ago

@Tyriar That exploration build does not exhibit the problem, works fine for me.

eterevsky commented 6 years ago

@Tyriar Great! The new build works fine for me as well, even scrolling is pretty smooth.

Thanks!

Tyriar commented 6 years ago

@dkent600 @eterevsky awesome! I'll close this off then for the April release. There are some more performance improvements to come, but I'm glad this issue is solved.

eterevsky commented 6 years ago

@Tyriar I just installed version 1.23.0, and the issue is still present. Could you tell me, in which release is it expected to be fixed?

Tyriar commented 6 years ago

@eterevsky It's being improved when we bring in Electron 2 which was pushed out from April (will probably be June). I'm not tracking this class of issues in https://github.com/Microsoft/vscode/issues/46954

johndevedu commented 6 years ago

@eterevsky If you get the Insiders edition, I'm pretty sure the problem is gone.

S-t-e-p-s commented 6 years ago

This happened to me on my laptop (4K screen size) where I turned off external GPU unit and instead was using integrated intel gpu. Terminal was consumig a lot of integrated GPU power thus whole IDE was hanging. Switching to insiders edition didn't help for the same reason. Running IDE with: code --disable-gpu resolved the issue. I updated shortcut to run with this parameter - so far everything works fine. I'm using Window 10 laptop with integrated GPU unit.