I have installed Ubuntu 18.04 LTS I used to use Visual Studio Code for my projects but the problem is that it is very slow. It hooks or locks, I do not know how to put it so that they understand me, because I use the translator and I do not know what will be better. The fact is that it is very bad, both in this version and in 16.04. I also have it in Windows and it works perfectly. Sometimes it crashes, blocking all processes and denying access to the computer. Does that have something to do with Ubuntu, should I optimize it in any way? If you give me some idea, well, as I said, I got used to Visual Studio and I tried Sublime text-3 which is much better, but I should get used to it and I do not like it very much. Forgive the syntax, I must use the translator. Thank you.
6 Answers
From https://code.visualstudio.com/docs/editor/integrated-terminal:
By default, the integrated terminal will render using GPU acceleration on most machines. It does this using multiple elements, which are better tuned than the DOM for rendering interactive text that changes often.
However, Electron/Chromium are slower rendering to canvas on some environment and so VS Code also provides a fallback DOM-renderer experience. VS Code will try to detect slow performance and give you the option to change via a notification.
You can also change the rendering directly by setting terminal.integrated.gpuAcceleration in your user or workspace settings. (On Windows/Linux: File > Preferences > Settings)
{
"terminal.integrated.gpuAcceleration`": "off"
}
Something else that might improve performance is to ignore Chromium's GPU blacklist by launching VS Code with code --ignore-gpu-blacklist.
It worked for me, not like a real terminal but better than nothing, I hope this helps!
- 123
- 171
special thanks to this reddit post.
my problem with vs code: bad performance when writing text and selecting text in the editor. freezes about 0.5 seconds
there are several causes for this problem:
monitor refresh rate
(desktop user case) check you graphics card refresh rate. if you GPU has a max of 60hz then configure your monitor to 60hz.
if you have a secondary external monitor (laptop user case), then:
check your gpu refresh rate.(for example you find 60hz)go to settingsmake secondary monitor primarydisable built-in display(laptop display)set secondary monitor to 60hzreboot
for me, this option with refresh rate worked like a charm. right now its not lagging anymore when typing/selectin text and im using manaro 21 xfce. i know, why talking about manjaro on askubuntu, but i had the same problem in ubuntu 20.04 gnome too, but at that time i wasnt stroke with a refresh rate idea.
vim emulator vs code extension
usually, vs code is handling the keypresses by itself, but when vim extension is installed it overrides the control. vim extension is single-threaded and not very well optimized and when you type you may have bad performance, so uninstall vim extension.
too many extensions
try uninstalling the unimportant extensions or make a sacrifice to reduce the total number.
bad graphics driver
try using other graphics driver. use open-source ones, try performance. use proprietary ones, try performance.
laptop is in power saving mode
try setting your cpu to performance mode.
EDIT date: (11.05.2022)
the problem was my HDD, was too slow. after moved to SSD, performance of writing text is good, because write and read speed from the SSD is faster.
but vs code is still slow. performance is really bad (compared to sublime + im very impatient).
solution: move to sublime text 4.
done.
indeed, vs code is slow
- 275
As of Feb 2022, some systems still experience poor performance in the latest VS Code with default settings on Ubuntu 20.04. However, the options below have been known to resolve the issue. YMMV, depending on system configuration and hardware.
The most likely culprit for general slowness of Electron apps on Linux is a lack of GPU acceleration, which is (often? always?) disabled by default. To check whether the underlying Chromium engine provides hardware acceleration to VS Code:
- Open a VS Code window
- In a separate terminal window, run
code --status - Check the output for errors, and note the "GPU Status" section.
If hardware acceleration appears to be disabled, (e.g., webgl: disabled_software, skia_renderer: enabled), performance will likely suffer until that's addressed.
Option 1: Ignore GPU Blacklist
In some cases, Electron/Chromium may prevent VS Code from enabling GPU acceleration due to a blacklist, which can be disabled by launching VS Code with code --ignore-gpu-blacklist. It's expected that the following warning appears:
Warning: 'ignore-gpu-blacklist' is not in the list of known options, but still passed to Electron/Chromium
The difference will be very noticeable if this worked, particularly in the integrated terminal.
Option 2: Edit Terminal Rendering Setting
According to the vscode docs, the integrated terminal renderer can be changed with the setting, terminal.integrated.gpuAcceleration. The default value is "auto".
The terminal features 3 renderers that fallback if they are detected to perform poorly in this order:
- WebGL (
"terminal.integrated.gpuAcceleration": "on"or"auto") - Canvas (
"terminal.integrated.gpuAcceleration": "canvas" - DOM (
"terminal.integrated.gpuAcceleration": "off")
Note that it can be difficult to confirm whether vscode is obeying this setting. (Please, someone update this answer if you know how to check this!)
(Older versions of vscode had a similar setting, terminal.integrated.rendererType, which no longer exists.)
Option 3: Check Video Card Drivers
Linux tools provide many ways to check video card drivers, and the methods for updating drivers vary by manufacturer and preferences about third party. That's outside the scope of this question, but
- Which display drivers are in use?
sudo lshw -c video - Can the system render something basic at 60fps?
sudo apt-get install mesa-tools; glxgears - Where do I find more? In Firefox, the
about:supportpage has heaps of video card & driver info. - Even more???? Look elsewhere.
Option 4: Look for Misbehaving Extensions
Sometimes it crashes, blocking all processes and denying access to the computer
Even though that symptom hints at another problem, start with the GPU acceleration options above because other performance issues may be harder to track down. Next, disable extensions to narrow down whether the performance drag comes from vscode itself or a misbehaving extension. Tools like top can also be used to determine which process is overusing resources.
Option 5: Reinstall VS Code
I'm almost embarrassed to add this option, but it saved me today. After some updates (and a system restart), --ignore-gpu-blacklist stopped working, and nothing I tried could fix it. After tracking down a few of the errors in code --status, I concluded that there might be something wrong with the Snap package for VS Code. I downloaded the .tar.gz from the website, and thankfully the hardware acceleration is working again.
Option 6: Profile VS Code
I haven't gotten this far down the list, but if nothing else works, there is a way to profile vscode itself with dev tools.
- 123
tl;dr snap package caused problems, installation via apt worked fine
In October 2024, I had a fresh snap installation of VS Code running slow on Ubuntu 24.04 on a fast computer. I noticed that the rendering of the text selection in the editor was really slow; also switching editor tabs caused artifacts occasionally.
I tried start up via code --ignore-gpu-blacklist which resulted in a slight improvement - but was still far from good.
Eventually, I uninstalled the snap package and reinstalled VS Code via apt. This resolved my issues entirely. Running code --status showed that webgl and webgl2 now are enabled, which wasn't the case before.
Installation via apt is possible by adding the Microsoft VS Code repository first. A step-by-step guide can be found here
- 111
In my case that was the workspace issue, It had become too big - a lot of data including photos was in a folder. After I moved the data folder outside the workspace, it became so much smoother with nearly no delay.
I have a RTX GPU and laptop (Nitro 5) having 144Hz display, connected to a Dell Ultrasharp monitor with 60 Hz display.
I had performance problem, that is lagging with first Chrome.I thought it was something to do with memory and deleted the kubernetes kind cluster running in my machine. But still there was this problem. Then installed firefox and was happy with that.
But then I opened VS Code and the same problem there. I read somewhere that both Chrome and VSCode has this Electron based backend. So I figured it was not the memory but something else. I tried to disable the GPU setting as was given in other answers. To no avail.
Then I just made the laptop screen as primary and my extended display as secondary and the problem disappeared !
Note i use PopOS which is based on Ubuntu
- 302
- 3
- 7