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

Input latency is a lot higher than the default WSL Ubuntu terminal #145

Closed
nickjj opened this issue Jan 27, 2019 · 43 comments
Closed

Input latency is a lot higher than the default WSL Ubuntu terminal #145

nickjj opened this issue Jan 27, 2019 · 43 comments

Comments

@nickjj
Copy link

nickjj commented Jan 27, 2019

Hi,

I normally use the ubuntu.exe terminal that ships with WSL Ubuntu by default and it has a level of smoothness that is unlike any other Windows application. The reasons for that are stated at microsoft/terminal#327.

I wanted to give your terminal a try because ubuntu.exe lacks a few things that are very important to me, such as keyboard shortcuts to adjust font sizes.

But your terminal has an extra 100-150ms of input latency. In other words, every key stroke feels like it's delayed by about 150ms before it appears on the screen. This makes a massive difference to how it feels when typing.

Would it be possible to do whatever ubuntu.exe does to handle input?

@mintty
Copy link
Owner

mintty commented Jan 27, 2019

But your terminal has an extra 100-150ms of input latency.

Certainly not. If that was the case, it would have gained many more complaints already. There is no such significant latency here. So there must be something peculiar in your environment.

Would it be possible to do whatever ubuntu.exe does to handle input?

So what does it do that you'd consider beneficial?

@nickjj
Copy link
Author

nickjj commented Jan 27, 2019

If I open ubuntu.exe and your terminal side by side and just hold down a key, it's A LOT smoother on ubuntu.exe. It's not even comparable. This is on a brand new fresh Windows 10 Pro installation. Typing feels a million times better on ubuntu.exe. I'll make a video if you'd like but I'm not sure if it's going to show up on camera.

The reason you don't see more people bring it up is because most people aren't even aware of the situation because they don't use ubuntu.exe. That or they have low quality LCD monitors that have 50-100ms+ of input lag so from their POV there's no difference.

So what does it do that you'd consider beneficial?

It's a lot smoother when typing. Instead of feeling like I'm typing in mud, it feels like I'm typing on air. If you spend all of your time typing in a terminal, this makes a big difference in overall developer happiness.

To be fair, it's not because your terminal is "bad". Typing inside of this github issue comment box on Chrome also feels a lot more delayed than ubuntu.exe and the reason is due to the explanation in the issue I linked in the original issue.

But, I think they made the conhost API available to use now? I don't know the details but the overall idea is Microsoft made it seem like third party terminal developers can now get now benefit from the same low latency that ubuntu.exe has to offer.

@mintty
Copy link
Owner

mintty commented Jan 27, 2019

So what does it do that you'd consider beneficial?

It's a lot smoother when typing.

You've pictured that already. The question was what does it actually do to achieve that? Especially to gain an experience factor of a million. As you are interested in such improvement, you could perhaps provide a summary of technical issues described in that lengthy issue, for now.
Also please get yourself a cygwin installation and comment on the feedback feeling of mintty, without WSL. I have the idea that some delay may be imposed by the wslbridge gateway.

@nickjj
Copy link
Author

nickjj commented Jan 27, 2019

The question was what does it actually do to achieve that?

It has a negative effect on my overall mindset.

Every time I open the terminal I think "sigh, every time I type a key, I see a jittery output that's delayed... I wish it were as fast as ubuntu.exe". That in turns demotivates me to write code, and instead focus on tinkering with my environment (switching terminals, etc.) instead of being happy with what's available.

If the goal of the terminal is to assist the user in getting work done, then it's a conflict of interest to have a lot of input latency or other features / anti-features that pull you away from getting work done.

As you are interested in such improvement, you could perhaps provide a summary of technical issues described in that lengthy issue, for now.

I'm not a terminal developer so I can't summarize everything. I recommend reading Microsoft's blog post here https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/ as it has a break down on the before / after on how rendering characters on the screen works.

I have the idea that some delay may be imposed by the wslbridge gateway.

ubuntu.exe is also using WSL but it somehow doesn't have the added latency with wslbridge.

It's not just your terminal by the way. ConEmu, Cmdr, Hyper and a bunch of others have equal or worse latency than wsltty.

@Biswa96
Copy link
Contributor

Biswa96 commented Jan 27, 2019

No latency on my side. I'm (ab)using WSL everyday and I use wsltty/wslbridge also with it. Not any issue.

@mintty
Copy link
Owner

mintty commented Jan 27, 2019

@nickjj, I had not requested to describe your mindset in more variations, you've made your point.
The question was to contribute with some technical directions what to do. If you can't that's OK but you'll have to live with some minor latency for a while, especially as you state yourself it's neglectable compared to other terminals, so what? I.e., assuming there is any such latency at all, which others cannot reproduce.

@nickjj
Copy link
Author

nickjj commented Jan 27, 2019

@mintty I've linked you to multiple sources on how to proceed forward with technical details, all of which are above my pay grade.

For now, I've made a quick video demonstrating the problem:

https://drive.google.com/file/d/1L5gIR5Jnf1HiTJiKzteAsbfDqv2qQSz8/view

I'm going to make a more in depth video and post it on my Youtube channel another day and then ask others to directly test it, and hopefully we'll have more sample sizes then.

I covered this in the video but as mentioned before, others aren't writing in with this issue because they either have low quality monitors or never bothered to test ubuntu.exe directly, or are so used to typing in VSCode and other inefficient applications that they can't distinguish fast and slow anymore.

@Biswa96 Have you directly compared it side by side with ubuntu.exe with the same font? What monitor do you have exactly?

@Biswa96
Copy link
Contributor

Biswa96 commented Jan 27, 2019

@nickjj Yes, I've compared directly side-by-side. My monitor is 5-6 yr. old, guess it's specs !lol!

Some question though, wslbridge uses sockets in localhost, do you have any network congestion in localhost (using node, ruby etc.)? Did you try wslbridge.exe directly without mintty, any issue?

@mintty
Copy link
Owner

mintty commented Jan 27, 2019

Video does not seem to make much sense for a demo.
Biswa had a good point, please try to check that out before posting to the world...
Also it's necessary to separate possible causes, e.g. by installing cygwin as I requested, or using wslbridge directly from Windows cmd.exe (cd %LOCALAPPDATA%\wsltty\bin first) as Biswa suggested.

@nickjj
Copy link
Author

nickjj commented Jan 27, 2019

@Biswa96 I can't guess its specs but if you give me the exact model number I can attempt to look up what its measured input lag is which would help determine why you can't notice a difference. If your monitor has a lot of input lag you won't notice much.

What do you mean by network congestion in localhost? I'm not running any WSL processes like a Ruby web server, but in the ubuntu.exe case I have run Jekyll and other processes without issues.

Show me the exact command to try and I will give it a test.

By the way, the video does at least show the jitteryness of how characters are placed on the screen with wsltty vs ubuntu.exe. Even if I set the cursor style to underscore, it's very noticeable.

@mintty
Copy link
Owner

mintty commented Jan 30, 2019

As the title is misleading, considering your own comparison of wsltty to be better than many others, because latency may be a bit higher but certainly not "a lot", I'm inclined to close this issue. Also due to lack of further cooperation to isolate the effect.

@nickjj
Copy link
Author

nickjj commented Jan 30, 2019

As the title is misleading, considering your own comparison of wsltty to be better than many others.

It's a lot higher than the default WSL Ubuntu (ubuntu.exe) terminal. The title is an exact match.

Also due to lack of further cooperation to isolate the effect.

How is there a lack of cooperation? I've been waiting on you guys on 2 pieces of information.

  1. @Biswa96's exact monitor model number.

  2. An exact command / workflow instructions on how to test wslbridge. I'm just an end user of WSL. I never ran wslbridge directly. What do I need to do exactly to test this?

@mintty
Copy link
Owner

mintty commented Jan 30, 2019

OK, a bit more explicit than in my previous comment:
Test case 1:

  • Start a Windows cmd console (Win+r, cmd Enter)
  • cd %LOCALAPPDATA%\wsltty\bin
  • wslbridge
  • If it asks you for a terminal name, enter xterm

Then you should be connected to WSL. How does it behave?

Test case 2:

  • From https://cygwin.com/ download the setup.exe program and run it (select a "mirror" for download at one point, don't change anything else for a minimal installation)
  • Run "Cygwin Terminal" from the installed desktop icon

Now you are running a mintty terminal without WSL. How does it behave?

@nickjj
Copy link
Author

nickjj commented Jan 30, 2019

Then you should be connected to WSL. How does it behave?

wslbridge.exe feels just as fast as running ubuntu.exe or wsl.exe directly, which is what I've been using as the default WSL Ubuntu terminal and was compared to wsltty in the video. It's extremely responsive for key presses and noticeably less delayed than wsltty.

Test case 2 isn't going to happen, sorry. I'm not going to install cygwin on this machine.

@mintty
Copy link
Owner

mintty commented Jan 31, 2019

Mintty (the actual terminal) has an input/echo latency of ~30-45ms, which was considered to be neglectable. It can be reduced to 15-30ms which I'll probably do for the next release.
If you claim more than 100ms, there could be some high load in the background of your system.

@nickjj
Copy link
Author

nickjj commented Jan 31, 2019

There's no load on the system. My CPU is an i5 3.2ghz with less than 5% load.

Keep in mind, wslbridge.exe, wsl.exe and ubuntu.exe don't have this added input latency. It's just your terminal. This is on the same hardware too.

@mintty
Copy link
Owner

mintty commented Feb 5, 2019

For the 30ms input echo latency delay that used to be considered neglectable, mintty now has a shortcut to avoid it.
As this is not wsltty-specific, I'm closing this issue here.

@mintty mintty closed this as completed Feb 5, 2019
@nickjj
Copy link
Author

nickjj commented Feb 5, 2019

Is it released? How would I go about enabling this shortcut?

@mintty
Copy link
Owner

mintty commented Feb 5, 2019

It's not released, and there are a number of other issues in the queue. It will not need to be enabled.

@nickjj
Copy link
Author

nickjj commented Mar 21, 2019

Hey,

I noticed you released the patch for mintty/wsltty which has the -30ms applied but you pulled the wsltty Windows installer with a message of [Installer withdrawn. Wait for 2.9.9 please.].

Do you plan to cut a new wsltty release soon? I noticed mintty 2.9.9 is out.

@mintty
Copy link
Owner

mintty commented Mar 21, 2019

Yes, soon. There's another issue first; 1.9.9 will be skipped.

@fculpo
Copy link

fculpo commented Apr 10, 2019

Hi, any news about this ?

@mintty
Copy link
Owner

mintty commented Apr 10, 2019

Mintty 2.9.7 has an optimization for the latency. As small as it was, it should be gone.

@mintty
Copy link
Owner

mintty commented Apr 10, 2019

Oh, well; admittedly, 2.9.6 is still the latest wsltty release...

@nickjj
Copy link
Author

nickjj commented Apr 10, 2019

Is there anything we can do to get a new wsltty release that has the latency fix?

@mintty
Copy link
Owner

mintty commented Apr 10, 2019

Well, I just discovered a serious bug in 3.0.0 but it's unlikely that anyone else discovers it :) So I could make a 3.0.0 release tonight, or a 3.0.1 next week.

@fculpo
Copy link

fculpo commented Apr 10, 2019

both would be appreciated :)

@mintty
Copy link
Owner

mintty commented Apr 11, 2019

Released 3.0.0, however marked as a "pre-release" because I cannot currently test it.

@nickjj
Copy link
Author

nickjj commented Apr 11, 2019

Is the -30ms option enabled by default? In other words, if I configure nothing differently, will the latency reduction occur? If not, how do you enable it?

@mintty
Copy link
Owner

mintty commented Apr 11, 2019

Yes.

@nickjj
Copy link
Author

nickjj commented Apr 12, 2019

I just installed it and loaded it up side by side with the default WSL terminal.

So far the results look promising. It's hard to put a number on it, but it "feels" like it's 95% as fast as the default WSL terminal. That jitteryness (which was shown on video) that was present in previous releases is no longer there. Nice work!

I'll continue to use and test 3.0.0 and upgrade to 3.0.1 when it's available.

@mailinglists35
Copy link

mailinglists35 commented May 15, 2021

I am still experiencing this. the lag is so big that I can't use the app at all. pc works okay for other apps. particularly native wsl, mobaxterm and putty work without any lag.

windows Version 10.0.19042 Build 19042
wsl 1

@mailinglists35
Copy link

attempting to run wslbridge as instructed somewhere in a 2019 comment results in the following output:

C:\Users\user\AppData\Local\wsltty\bin>wslbridge.exe
wslbridge error: failed to start backend process
note: backend error output: -v: -c: line 0: unexpected EOF while looking for matching `''
-v: -c: line 1: syntax error: unexpected end of file

@mailinglists35
Copy link

I looked at command arguments of a running wsltty and I manually launched mintty like this:

mintty.exe --WSL= --configdir="C:\Users\user\AppData\Roaming\wsltty" -~  -

got the same window as wsltty but the lag is not present.

@mailinglists35
Copy link

also the font appears to be bolder on wslterm than on mintty.

@mailinglists35
Copy link

wsltty window (on right) appears to redraw like serial console lines on a cisco router

video: https://imgur.com/a/ngl0ipu

@mailinglists35
Copy link

I think mine is a different issue though; there is no lag typing, but there is a lag displaying scrolling text - the whole window redraws with lag

@mailinglists35
Copy link

yes, it's clearly a different issue.

https://imgur.com/a/dCnxlM9

down left native wsl1, down right mobaxterm, up left mintty, up right wsltty

@mintty
Copy link
Owner

mintty commented May 15, 2021

The second picture does not show anything. The first shows noticeable screen updates during scrolling, albeit nothing comparable to serial lines (try mintty -o Baud=9600 to know what that would mean). However, you don't describe any context. Maybe you're running in something like tmux and for some reason the whole screen is repainted for every scroll line...

@mailinglists35
Copy link

mailinglists35 commented May 15, 2021

they're both videos. you can also download them and playback at 10x slower speed to observe the difference.

what context? context is: wsltty is awfully slow to repaint the terminal and it's unusable for me because of that effect. I'd like to be able to use it instead of mobaxterm and native wsl, but that prevents me from using it.

on second video I run mc under screen to precisely show how each client behaves for the same output at the same time

@mailinglists35
Copy link

on first video there is no screen/tmux involved, just two ssh sessions running same tcpdump command, one with mintty one with wsltty

@mintty
Copy link
Owner

mintty commented May 15, 2021

Iterating your complaint is not a context and not an explanation of what your issue might be.
If you make a claim that something should be improved, it's your term to demonstrate it clearly and reproducibly.

@mailinglists35
Copy link

demonstrate it clearly and reproducibly.

i just uploaded a video demonstration of the behaviour. i really don't know what else than a video sample is more relevant to describe how poor the ui experience is.

reproductibly

i have no idea if it's reproductible. i just report that it lags while other apps don't or do it less intense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants