-
Notifications
You must be signed in to change notification settings - Fork 6.3k
-
Has anyone noticed that typing into the Integrated Terminal is very slow and laggy? It happens in the default Bash shell, but feels a little more pronounced when I'm using PowerShell.
I'm running code-server
as a Docker container on a headless Ubuntu Server Linux 24.04 system. The hardware is Ryzen 3900X 12-cores (24 threads), 64 GB DDR4 RAM, and an NVIDIA GeForce RTX 3060 12 GB, and a 1 TB NVMe SSD. It's a pretty fast bit of hardware, especially for a homelab Linux server.
I don't have this problem in the VSCode code editor at all. It only happens in the integrated terminal.
I'm using Chrome on my Windows 11 system to access VSCode. I've also tried both Firefox and Chrome on an Android Samsung S7+ tablet, and the behavior is consistent. The typing in the Integrated Terminal is laggy.
Any suggestions on how to fix this? It makes development not so fun as running VSCode locally.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
I think the server hardware would probably be unrelated, it would either be the browser or the network connection. The terminal has to make round trips for every character but the editor does not, so latency is much more apparent in the terminal.
As for ideas, maybe you can mess around with the terminal settings. For example there is one about GPU acceleration that seems to cause a lot of issues for people. There is also a predictive output setting that is supposed to make lag less noticeable, but we also have had reports that it is buggy, so toggling that may help.
Ultimately, you might have to raise this upstream to the VS Code folks, we just wrap the web version of VS Code and do some light patching, but nothing that would cause this I think. Are you able to reproduce in GitHub Codespaces?
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks, Asher.
I just launched a GitHub Codespace in Chrome on my high-end Windows 11 workstation. While I can still tell typing isn't quite as responsive as the text editor, it doesn't have the same lag that code-server
terminal has. Typing into the Codespace Integrated Terminal is quite "acceptable."
I'm using SpaceX Starlink, for what it's worth, and get about 30ms to 1.1.1.1
.
- My internal network is pretty fast. Flat routing structure. The slowest thing is that I'm using TP-Link TL-WA1201 WiFi bridges on both my workstation, and the Linux server I'm accessing. This allows:
- Use their wired network interfaces, instead of hassling with WiFi driver issues on both sides. I occasionally use Hyper-V on Windows 11, and wired NICs just work better.
- Other wired-only devices (eg. RTSP network security cameras) can share the same WiFi bridge via a "dumb" layer 2 switch
- Latency: I'm getting 2-6ms ping times to the Linux server from my workstation.
- SSH: Accessing a standard SSH session on the same Linux server as
code-server
is running on doesn't yield any performance issues. - Doing an SFTP transfer, I'm getting sustained 10.5 MB/sec (~100 Mbps) transfer rates.
I would record a video to demonstrate / reproduce the issue, but I think it might be kind of hard to capture / comprehend. You would need a high framerate and actually see my hands typing, to compare latency to when the characters appear on-screen. I haven't recorded any video repros of that nature before, so I'd have to put some thought into it.
I figured you might say that this is an upstream issue. That makes sense, as I'm sure you guys aren't doing anything special that would interfere with the Terminal.
I don't like the sound of the predictive typing thing, haha. That does sound ripe for bugginess. I'd rather fix the root cause of whatever is causing the typing lag. Not a bad suggestion though.
GPU acceleration setting: I will have to look this up and see if that has any effect. FWIW I do have the NVIDIA drivers installed inside the code-server
container (and on the host), and I can successfully use nvidia-smi
to "see" the RTX 3060 GPU.
Beta Was this translation helpful? Give feedback.
All reactions
-
I just tried turning the terminal.integrated.gpuAcceleration
setting off and on, and that doesn't seem to have any effect on the typing lag issue.
Beta Was this translation helpful? Give feedback.
All reactions
-
Interesting that Codespaces was better, that does seem to rule out any client/browser or xterm.js rendering issues at least.
I would record a video to demonstrate / reproduce the issue, but I think it might be kind of hard to capture / comprehend.
Yeah fair, unless the lag is extremely pronounced, it can be hard to visually identify it without being the one typing.
FWIW I do have the NVIDIA drivers installed inside the code-server container (and on the host),
The GPU acceleration is done on the client actually! I think xterm.js can use the GPU to render the characters on the canvas used for the terminal display, or something like that.
I don't like the sound of the predictive typing thing, haha
Yuuup my experience with it has been janky at best, but maybe they have improved it since I last used it.
2-6ms seems like it should be fine to me but this might be in the territory where you have to trace the packets through the socket over to the terminal service and back again to find the lag. The VS Code folks might have better suggestions on how to debug though.
Two other ideas:
- Just to be extra sure, if you try the xterm.js demo (https://xtermjs.org/) do you get any lag? This has no connected backend so it should be purely client rendering involved.
- You could try installing native VS Code in the container then run
code serve-web
to serve VS Code web without the code-server wrapper and see if the lag persists.
Beta Was this translation helpful? Give feedback.