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

Typing latency #296

Closed
indutny opened this issue Jul 19, 2016 · 47 comments
Closed

Typing latency #296

indutny opened this issue Jul 19, 2016 · 47 comments
Labels
😰 Can't Reproduce Reviewer can't reproduce issue and maybe needs more information 💬 Feedback Wanted Issue or PR needs input from the community! Lend your thoughts ✨

Comments

@indutny
Copy link

indutny commented Jul 19, 2016

Is there any way to reduce latency when typing things? It is not super slow, but noticeably slower than any other terminal that I use.

It feels like I'm typing on ssh terminal.

@matheuss
Copy link
Member

I don't see that latency here 😰

@rauchg
Copy link
Member

rauchg commented Jul 26, 2016

Neither do I. @indutny can you record a video with your mobile phone?

@matheuss matheuss added the 😰 Can't Reproduce Reviewer can't reproduce issue and maybe needs more information label Jul 26, 2016
@timothyis timothyis added the 💬 Feedback Wanted Issue or PR needs input from the community! Lend your thoughts ✨ label Jul 26, 2016
@iamstarkov
Copy link
Contributor

there are tools to objective latency measurement
https://pavelfatin.com/typing-with-pleasure/
in russian http://tonsky.livejournal.com/306545.html

@indutny
Copy link
Author

indutny commented Jul 26, 2016

@iamstarkov 👍

@indutny
Copy link
Author

indutny commented Jul 27, 2016

Just wrote a small C application to measure latency. Turns out HyperTerm is actually faster than iTerm2. My bad!

Still would be cool if anyone else would be able to confirm it independently. I am not absolutely sure that my tool is correct.

(The tool is here)

screen shot 2016-07-26 at 10 01 39 pm

@indutny
Copy link
Author

indutny commented Jul 27, 2016

Here is updated bench with the latency of typing in this comments form (just for fun):
screen shot 2016-07-26 at 10 04 21 pm

@indutny
Copy link
Author

indutny commented Jul 27, 2016

Though, may be HyperTerm just became faster since last time? :) Have you done anything about performance?

@matheuss
Copy link
Member

Can you publish that C app here at GitHub? I'm interested in how it works 😊

@indutny
Copy link
Author

indutny commented Jul 27, 2016

@matheuss I already did in a comment above. Here it is just in case: https://gist.github.com/indutny/b530593a996bbbe8bfd51fc3f38c45f2

@matheuss
Copy link
Member

Oh, my bad 😅 Thanks!

@ghost
Copy link

ghost commented Jul 27, 2016

Still would be cool if anyone else would be able to confirm it independently.

My observations (subjective) are that HyperTerm has noticeably less latency as I type than iTerm2 but in my case I know a lot of that is due to my zsh config which causes a lot of redrawing as I type.

Though, may be HyperTerm just became faster since last time? :) Have you done anything about performance?

There have been a couple of updates of electron in the HyperTerm package. The most recent one 1.3.0 updates Chrome to version 52 and node to 6.3.0. So there may be some performance improvements just from that.

@rauchg
Copy link
Member

rauchg commented Jul 27, 2016

There are certainly some actions at which HyperTerm can be slow. Typing in a new prompt is certainly not one of them (as shown above :P), but we have to consider a lot of different scenarios (like large screen redraws).

@indutny
Copy link
Author

indutny commented Jul 27, 2016

@freebroccolo

There have been a couple of updates of electron in the HyperTerm package. The most recent one 1.3.0 updates Chrome to version 52 and node to 6.3.0. So there may be some performance improvements just from that.

This must be it. I wish I had an old version to compare to.

@indutny
Copy link
Author

indutny commented Jul 27, 2016

Decided to publish my tool as a separate repo with build instructions (OS X only): https://github.com/indutny/latetyper

@matheuss
Copy link
Member

You can find the old versions here ^~^

@TooTallNate
Copy link
Member

Incredible @indutny

@indutny
Copy link
Author

indutny commented Jul 27, 2016

@matheuss just tested old versions, all of them seems to be faster than the latest iTerm2 :(

@indutny
Copy link
Author

indutny commented Jul 27, 2016

Good job HyperTerm, though!

@samccone
Copy link

Is there any way to reduce latency when typing things?

So it comes down to our measurement approach here. The approach. I chose here is "when can I see the letters after hitting a button on my keyboard". If we drop down into devtools and look at things per each frame we can get a better look at exactly when the new chars are shipped to the user.

image

^ We can see the majority of our frames are shipped to the user well under budget. Since the update loop for the screen is running inside of a requestAnimationFrame we are kinda self limiting how fast we are updating the screen (this is good, and bad in someways -- if we are trying to optimize for shipping the chars to screen as fast as possible)

image

I will be looking more into the costs associated with typing and some easy wins that we can get.

More on this later ✌️

@albinekb
Copy link
Contributor

@mike-engel
Copy link
Contributor

I've noticed some "perceived" latency when using the backspace key—that is, when typing, it seems pretty performant. When using backspace/delete, I've noticed that there's a small time difference between when the character goes away and when the cursor moves to the previous position. I don't know if this is what @indutny was talking about (it may have been typoing in both directions). If so, we can probably do some work to move the cursor faster to where it should be.

@samccone
Copy link

goes away and when the cursor moves to the previous position

This is due to how hterm implements the cursor update :)
https://github.com/dbkaplun/hterm-umdjs/blob/master/dist/index.js#L13004-L13013

I would say this is WAI :)

@mike-engel
Copy link
Contributor

Interesting...thanks @samccone. Probably some room for improvement there 😄

@chenglou
Copy link

I'm seeing the behavior described by @mike-engel as well. I frankly can't tell the latency difference between iterm and hyperterm, but that deletion latency is really visible.

@samccone
Copy link

@chenglou do you observe "latency" in the char being deleted or the cursor moving?

@chenglou
Copy link

The cursor moving. Also somewhat visible during insertion.

Here's a slowed down recording of what I'm seeing:
perceivedlatency

@samccone
Copy link

This is due to how hterm implements the cursor update :)
https://github.com/dbkaplun/hterm-umdjs/blob/master/dist/index.js#L13004-L13013

^ 😄 -- this could be fixed upstream

@Zirro
Copy link

Zirro commented Aug 27, 2016

I can confirm seeing the delay between character input and cursor movement as well. Unfortunately it is enough to make typing in HyperTerm an uncomfortable experience.

EDIT: Things seems to have changed for the better in builds of latest master, perhaps as a side-effect of another update since there was no mention here. The delay is far less pronounced and the improvement clearly visible on a slowed down recording.

@reicheltp
Copy link

I'm not sure if this belongs here or if I should open another issue, but:

If I am using render heavy commandline apps, e.g. midnight commander. I can recognize a very heavy latency of half a second with every input. This make it unusable.

You can reproduce this with installing midnight commander and just try to navigate with the arrow keys.

@samccone
Copy link

@reicheltp can you record a timeline please right click and save and then share a link to it on https://chromedevtools.github.io/timeline-viewer/

thanks

@rauchg
Copy link
Member

rauchg commented Nov 23, 2016

@reicheltp very interesting! I'd love to reproduce it as well. Can you tell me exactly what programs you open and in what order?

@reicheltp
Copy link

@samccone Here a short timeline:
https://chromedevtools.github.io/timeline-viewer/?loadTimelineFromURL=https://gist.github.com/reicheltp/0bd72cbe69575b43073c7b02320b4bc0/raw

The first long frame is, when I opened the midnight commander with mc, Second and third are a simple tab to switch columns. And fifth and sixth are page-up and page-down. As you can see, the frames are really long.

@rauchg I have used Midnight Commander for Windows (Get it here https://sourceforge.net/projects/mcwin32/) or the OSX/Linux version here (https://www.midnight-commander.org/)

My Setup is Windows 10 Enterprise x64 with latest Hyper.app. Tried with powershell and cmd.

@chabou
Copy link
Contributor

chabou commented Apr 13, 2017

@reicheltp is it still a valid issue? Can you reproduce with v1.3.1?

@reicheltp
Copy link

@chabou Although I can notice a slightly performance improvement with v1.3.1, the issue still exists.

@simoncpu
Copy link

I've just installed Hyper a while ago, and while I don't have any concrete data to back this up, I can definitely feel the typing delay.

@albinekb
Copy link
Contributor

Without plugin? What OS/Hardware? @simoncpu I can't feel it on my Macbook Pro 2017 running High Sierra, but that could be that my computer is overpowered 👍

@simoncpu
Copy link

@albinekb Yes, without plugin. OS is Windows 10 Pro, hardware is Thinkpad P51. I currently settled for wsltty because Bash on Windows works out of the box (I previously used ConEmu, but had problems with the colors).

BTW, I've just tried Hyper right now (normal command prompt, not bash), and there's a few milliseconds of delay between pressing the keyboard and displaying the characters on the screen. It's not a deal breaker, and I think most people won't notice it, but the experience is akin to typing commands in an SSH session.

@albinekb
Copy link
Contributor

Thanks for that @simoncpu, we're currently working on replacing the terminal rendering lib to xterm.js, which will give better results. After that there's lots more we can optimize to make it faster! 🎉

@simoncpu
Copy link

simoncpu commented Aug 31, 2017

I think I can feel (sorry, no hard data, just gut feel hehe) less lag when I right clicked on the Hyper icon and chose:

Run with graphic processor > Integrated graphics

The default is "High performance NVIDIA processor", although I think I recall having less lag when I used Hyper without an external monitor using the default settings a while ago. Electron issue with NVIDIA, maybe?

@vmourac
Copy link

vmourac commented Apr 4, 2018

Hi,
In my system the issue happens when I'm using hyperline#0.6.1...
As soon as I disable it in .hyper.js and restart the app, the latency vanishes

@balcsida
Copy link

balcsida commented Apr 5, 2018

Hi all,

I had experienced lags and high CPU usage on Windows 10 as well and it was resolved by adding %APPDATA%/hyper folder as an exclusion to all of my installed antivirus (Windows Defender and Malwarebytes in my case).
I believe this happens because Hyper is built on Electron and the current AV solutions thinks as a "browser".

@AustinTruex68
Copy link

I have tried what was posted above.. this never happened until I updated to 2.0. Does anyone else have some ideas as to what causes this latency? I don't wanna use cmd.

@chabou
Copy link
Contributor

chabou commented Apr 16, 2018

@AustinTruex68 are you on Windows?
This issue is quite outdated.

Maybe you have same problem than #2838?
If not please open a new issue with all needed information to reproduce

@chabou chabou closed this as completed Apr 16, 2018
@AustinTruex68
Copy link

@chabou, sorry about that. Yes it is the same issue as #2838

@offero
Copy link

offero commented Jun 2, 2018

@freebroccolo Can you elaborate more on the zsh issue? I am experiencing latency as well and want to figure it out.

@Draekus
Copy link

Draekus commented Dec 13, 2018

I'm on windows and I was also having a lot of latency issues with it. I was using with Gitbash (MINGW64) and if I opened up a new window and used cd, mkdir, ls etc. it was totally fine. However when I opened up node apps using inquirer, cl-table, etc. It would be so bad that scrolling would be impossible and there would be a 1 second lag typing in the prompts.

I'm really sad because I had a theme that matched my vscode which I really liked. Oh well.

@ericmhalvorsen
Copy link

ericmhalvorsen commented Jul 27, 2021

Here to confirm that it was the 'hyperline' plugin for me as well. Disabling the plugin fixes the issue outright

Hyperline/hyperline#198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😰 Can't Reproduce Reviewer can't reproduce issue and maybe needs more information 💬 Feedback Wanted Issue or PR needs input from the community! Lend your thoughts ✨
Projects
None yet
Development

No branches or pull requests