zed icon indicating copy to clipboard operation
zed copied to clipboard

Terminal input is slow

Open bersace opened this issue 1 year ago • 19 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Hi,

Thanks for Zed. It's getting better and better every weeks.

I adopted Zed the day it was available for Linux. I already use alacritty as my terminal, it's super fast. Ever since, typing in Zed embedded terminal is slow. Sometime, it's snappy. But most of the time, it stutters.

Environment

Zed: v0.153.6 (Zed)
OS: Linux Wayland debian 12
Memory: 15.3 GiB
Architecture: x86_64
GPU: Intel(R) UHD Graphics 620 (WHL GT2) || Intel open-source Mesa driver || Mesa 22.3.6

If applicable, add mockups / screenshots to help explain present your vision of the feature

I don't know how to investigate this. I'm open to help.

If applicable, attach your Zed.log file to this issue.

I did not found anything special regarding this in Zed log.

Regards, Étienne

bersace avatar Sep 24 '24 08:09 bersace

This bothers me too (on macOS). It's not that the terminal is slow, per se—it doesn't visibly lag when writing lots of output. The problem seems to be the keystroke latency, especially when editing the command line.

For example, if you simply hold down the spacebar, you can see the cursor stuttering and juddering, slowing down and speeding up from time to time as it struggles to keep up. It's annoying enough that I now switch to a dedicated terminal app when doing anything non-trivial in the Zed terminal.

bitfield avatar Sep 24 '24 09:09 bitfield

Would love to see a screen video of this, as I can't seem to reproduce it on my end on macOS (haven't tested on Linux yet).

JosephTLyons avatar Oct 01 '24 19:10 JosephTLyons

@JosephTLyons , thanks for your attention.

Here zed is struggling:

zed.webm

While alacritty is fine enough (inside Zellij):

alacritty.webm

bersace avatar Oct 03 '24 09:10 bersace

I noticed the same (Linux, 0.156.0), but mostly in nvim inside zed

Sh4d1 avatar Oct 09 '24 12:10 Sh4d1

Same issue especially when using helix in terminal.

failable avatar Oct 10 '24 12:10 failable

Same issue especially when using msys2 and powershell on windows in terminal.

Resince avatar Nov 05 '24 15:11 Resince

Similar issue using remote ssh with zed, I believe it's related to network performance. The character input in terminal has extremely high latency on poor network connections (coffee shop, hotel, etc). It sometimes becomes unbearably slow to type with characters appearing a few seconds after input. The issue isn't present with a strong/fast internet connection.. Seems for ssh, the terminal rendering each character is network dependent (send character -> receive confirmation -> render?)

Seltonu avatar Nov 09 '24 15:11 Seltonu

I can see the same input lag on macOS as well, when I open up Neovim (even if I start it in --clean mode) in the Zed terminal. It's a bit annoying, as I'm using Neovim to resolve merge conflicts, but the terminal gets so slow that I have to use something else.

joelazar avatar Nov 18 '24 23:11 joelazar

I noticed that when I open a remote session with Zed and launch a terminal and Neovim on the host, I cannot detect the stuttering that occurs in a local session.

joelazar avatar Dec 01 '24 07:12 joelazar

Okay, one more thing, I have a hunch that it might be related somehow to how much I zoomed in on the terminal. I managed to reproduce it quite deterministically by zooming in and out in the terminal and stepping on j and k in Neovim. As I zoom out, after a certain time, the scrolling of the buffer freezes until I stop pressing the key again.

https://github.com/user-attachments/assets/0a0c0f28-a7e3-4956-a70c-93e5441f158e

joelazar avatar Dec 02 '24 23:12 joelazar

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar Apr 02 '25 07:04 github-actions[bot]

Still reproducible:

https://github.com/user-attachments/assets/b6b43f49-d397-493b-83f4-73afc4ee5772

In all three modes (terminal, vim, and nvim) I just hold down i. In nvim, nothing happens until I release it (hence the jump from one i to many is).

I can reproduce by having a large terminal window and small text, but even a window of half the screen with default font size triggers this. I didn't start nvim with --clean in the video, but it makes no difference.

martinhath avatar Apr 02 '25 07:04 martinhath

I too experience some slowness, especially when running magit.

bersace avatar Apr 04 '25 06:04 bersace

i'm observing slowness when paging through large diffs.

video here where i hold down 'j' with a fast key repeat rate, it simply stops rendering until i let go and start tapping. ghostty pages fine on the same diff.

https://stuff.schpet.com/uploads/q2CeI8Lj3ZARNjRR0GZNX/Screenshot%202025-04-10%20at%2010.21.05.mp4

(ideally i'd be able to see a diff against arbitrary refs within zed itself so i wouldn't need to dip in to the terminal for this but that's a separate issue)

schpet avatar Apr 10 '25 17:04 schpet

I have a weird case where my nvim in the Zed terminal slows down dramatically (practically unusable) when in full screen (workspace::ToggleZoom), but the issue resolves when switched back to normal mode. Might be related. Running on latest macOS, M1.

metsis avatar Apr 16 '25 07:04 metsis

My terminal input slows down drastically when the terminal is zoomed in and the font is made smaller. Terminal is snappy again when font is zoomed past certain point.

sashkachan avatar Apr 22 '25 07:04 sashkachan

same here. it's smooth when I use nvim, until i zoom in. When I keep press down j or k it freezes

https://github.com/user-attachments/assets/4222b015-cdfc-45bd-9093-a5963bb96ede

tibitTW avatar Apr 30 '25 07:04 tibitTW

Another repro: When there is diff in the terminal history generated by delta the input gets extremely slow.

esamattis avatar Apr 30 '25 07:04 esamattis

I have discovered another way to recreate this very consistently: workspace::ToggleZoom and hackernews-TUI.

If one starts a terminal and runs hackernews_tui, it scrolls just fine for each keypress or holding. But as soon as you workspace::ToggleZoom it gets very sluggish. In some cases, it doesn't even send the keystrokes to the tui until the key is let up. workspace::ToggleZoom back to small, and it works fine again.

https://github.com/user-attachments/assets/bcbb927f-a8f9-43e5-a706-963042b5f1f2

theherk avatar May 12 '25 10:05 theherk

it happens to me only when I use vim inside the builtin terminal, very strange...

cuni0716 avatar May 22 '25 13:05 cuni0716

Unfortunately, despite the latest change, this still isn't fixed (vim in expanded terminal).

metsis avatar Jul 16 '25 12:07 metsis

@metsis can you please share more details about your system and setup, and what is still slow?

ConradIrwin avatar Jul 16 '25 20:07 ConradIrwin

Unfortunately, despite the latest change, this still isn't fixed (vim in expanded terminal).

Were you on Zed 0.195.x ? Just got Zed 0.195.2, and I can confirm terminal is now very fast (was slow when using vim previously).

dargor avatar Jul 16 '25 20:07 dargor

Unfortunately, despite the latest change, this still isn't fixed (vim in expanded terminal).

Were you on Zed 0.195.x ? Just got Zed 0.195.2, and I can confirm terminal is now very fast (was slow when using vim previously).

Oh yes - my bad, thought I was running the latest version. Now I can confirm everything's as fast as I expect it to be - thank you for noting it and thanks to @ConradIrwin & al for fixing this. :)

metsis avatar Jul 17 '25 05:07 metsis

All credit to @alisinabh :D

ConradIrwin avatar Jul 17 '25 14:07 ConradIrwin