Eugeny / tabby

A terminal for a more modern age
https://tabby.sh
MIT License
58.77k stars 3.37k forks source link

Mouse Highlighting and Keyboard input stuttering #5459

Open leemmcc opened 2 years ago

leemmcc commented 2 years ago

Describe the problem: Sorry but this may sound odd, but it's really disconcerting to have it happen. When I'm typing (or even hitting enter) sometimes it seems the display freezes and either doesn't take the input, or doesn't show output - hard to tell which, for sometimes almost half a second, then it will 'catch up'. It's not every single press, but more often than not, even if I just open a terminal and keep tapping enter like once a second it's largely noticible. With the mouse, if I click and drag to highlight a section, the pauses seem to effect what is being shown as highlighted as well, the action is not smooth. When typing, it almost feels like you would feel if you were losing packets on a remote server.

I've tried it with the 'disable gpu acceleation' box ticked (and restarted), but it doesn't seem to make a difference. Also - if I open a tab and just hold down enter, my GPU goes to ~53% usage just from Tabby, even with acceleration disabled. Git bash window outside of tabby does not do this, git bash window inside of tabby does it. CMD window outside of tabby doesn't have the issue, CMD window inside tabby does. I've checked with a wsl instance and also get the same behavior.

I've noticed it also happens when just scrolling as well, the scroll will freeze then 'catch up'. I just had it happen on the settings -> config page

This occurs on a fresh boot of my machine with no other major apps open at the time. Hardware is:

Processor 12th Gen Intel(R) Core(TM) i5-12600K, 3686 Mhz, 10 Core(s), 16 Logical Processor(s) Installed Physical Memory (RAM) 32.0 GB GPU NVIDIA GeForce RTX 3080 Ti

To Reproduce: I've tried the last 4-5 versions available via the releases tab and get the same behavior with all of them. I've tried disabling all plugins except for 'core' and 'electron' and still get the freezes in the settings / config editor as a test. Also deleted the config file and relaunched and still get it.

Eugeny commented 2 years ago

Please capture DevTools console logs at the time of the issue: https://github.com/Eugeny/terminus/wiki/Debug-logs

GitHub
Debug logs · Eugeny/tabby Wiki
A terminal for a more modern age. Contribute to Eugeny/tabby development by creating an account on GitHub.
leemmcc commented 2 years ago

So I noticed that even the debug window has the micro pauses at the same time. This isn't happening with any other browser or window that I have open (even simultaneously), unfortunately the debug console doesn't "update" during these pauses with any particular error, but here's what's there by default when I open it. Even when not typing, I notice the 'pause' behavior manifesting in just the blinking cursor... it's a very irregular pattern as whatever it is is blocking the display.

https://user-images.githubusercontent.com/22350738/149229944-5cce8ab2-e680-428a-9a07-c88c12ff4034.mp4

node:electron/js2c/renderer_init:33 The vm module of Node.js is deprecated in the renderer process and will be removed.
o._load @ node:electron/js2c/renderer_init:33
entry.ts:56 Window bootstrap data: Object
plugins.ts:132 Found community-color-schemes in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found core in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found electron in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found linkifier in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found local in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found plugin-manager in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found serial in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found settings in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found ssh in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found telnet in C:\Program Files\Tabby\resources\builtin-plugins
plugins.ts:132 Found terminal in C:\Program Files\Tabby\resources\builtin-plugins
entry.ts:67 Starting with plugins: Array(11)
plugins.ts:178 Loading terminal: C:\Program Files\Tabby\resources\builtin-plugins\tabby-terminal\dist\index.js
plugins.ts:178 Loading telnet: C:\Program Files\Tabby\resources\builtin-plugins\tabby-telnet\dist\index.js
plugins.ts:178 Loading ssh: C:\Program Files\Tabby\resources\builtin-plugins\tabby-ssh\dist\index.js
plugins.ts:178 Loading settings: C:\Program Files\Tabby\resources\builtin-plugins\tabby-settings\dist\index.js
plugins.ts:178 Loading serial: C:\Program Files\Tabby\resources\builtin-plugins\tabby-serial\dist\index.js
plugins.ts:178 Loading plugin-manager: C:\Program Files\Tabby\resources\builtin-plugins\tabby-plugin-manager\dist\index.js
plugins.ts:178 Loading local: C:\Program Files\Tabby\resources\builtin-plugins\tabby-local\dist\index.js
plugins.ts:178 Loading linkifier: C:\Program Files\Tabby\resources\builtin-plugins\tabby-linkifier\dist\index.js
plugins.ts:178 Loading electron: C:\Program Files\Tabby\resources\builtin-plugins\tabby-electron\dist\index.js
plugins.ts:178 Loading core: C:\Program Files\Tabby\resources\builtin-plugins\tabby-core\dist\index.js
plugins.ts:178 Loading community-color-schemes: C:\Program Files\Tabby\resources\builtin-plugins\tabby-community-color-schemes\dist\index.js
C:\Program Files\Tabby\resources\builtin-plugins\tabby-core\dist\index.js:17440 [main] v 1.0.169
C:\Program Files\Tabby\resources\builtin-plugins\tabby-core\dist\index.js:17440 [hostApp] CLI arguments received: Objectargv: {_: Array(0), $0: 'Tabby.exe'}cwd: "C:\\Program Files\\Tabby"secondInstance: false[[Prototype]]: Object
undefined:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
C:\Program Files\Tabby\resources\builtin-plugins\tabby-terminal\dist\index.js:7973 Color: null is invalid using fallback #000000
e._parseColor @ C:\Program Files\Tabby\resources\builtin-plugins\tabby-terminal\dist\index.js:7973
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/app.asar.unpacked/assets/webpack/index.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-drag-drop.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-scrolling.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-coercion.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-platform.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-bidi.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-collections.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-a11y.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-keycodes.umd.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/cdk-observers.umd.js.map: Unexpected end of JSON input
5DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/app.asar.unpacked/assets/webpack/index.js.map: Unexpected end of JSON input
DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/resources/app.asar/dist/index.js.map: Unexpected end of JSON input
5DevTools failed to load source map: Could not parse content for file:///C:/Program%20Files/Tabby/app.asar.unpacked/assets/webpack/index.js.map: Unexpected end of JSON input
leemmcc commented 2 years ago

I thought it was interesting that even with 'disable acceleration' checked on in settings, I can still spike my gpu to 40-50% just holding down enter (especially on a 3080Ti). I tried launching it from the command line with --disable-gpu and the problem with the freezing goes away completely.

Eugeny commented 2 years ago

My bad - the "disable GPU" checkbox only worked on Linux. I've now pushed support for other platforms to nightly. Would still be interesting though to see whether the pauses show up on the performance flamegraph in Devtools.

leemmcc commented 2 years ago

Not exactly sure how to interpret this.. captured for about 13 seconds and hitting enter a bunch of times during it (as well as a few seconds of idle) image

Eugeny commented 2 years ago

Yep, the long frames are clearly visible in the "frames" lane, but there's barely any associated CPU activity to them. If --disable-gpu works for you, that means it's some sort of a driver issue. The best I can do is suggest grabbing the nightly build, which enables the "disable GPU" option on Windows :/

leemmcc commented 2 years ago

Sounds good. I don't notice anything worse off with gpu disabled overall, but it was driving me crazy with the microstutters. Will keep trying it now and then to see if anything improves.

leemmcc commented 2 years ago

Ok, not sure if you'll see this - but I think I may have found it. I may reboot and do some more testing, but when I mentioned above that I saw the gpu spike to 50%+ when I held ender down - I have a feeling Tabby may have been binding to my integrated GPU and not my 3080Ti. I never realized if perfmon showed gpu 0 or gpu 1. I just realized that I had both "enabled" in my BIOS, even though I only have the 3080Ti connected to my displays. I just disabled the integrated GPU altogether, and trying tabby with acceleration enabled - no freezing at all, Tabby only using 1.5% GPU even holding enter down, no freezes, either. So Tabby with GPU acceleration on i5-12600K may be what was doing it. I'll do some more testing just to confirm, I just hate getting motivated to keep rebooting.

leemmcc commented 2 years ago

Confirmed - with both GPU's enabled, you can see Tabby defaulted to my iGPU (GPU 0) - it's only with that configuration (I haven't yet tried upping the shared memory to see if that helps at all, but I can try that next) that the stuttering happens.

image image

leemmcc commented 2 years ago

I was able in Windows graphics settings to change it, for whatever reason the default for tabby specifically was 'power saving'. image

I'm going to reopen this, just in case there is something you may want to add in the app to handle this by default (selecting discrete GPU or somehow enabling the high performance mode during install? Not sure what options you may have) feel free to close it out again or reclassify if you want to. This was driving me crazy though, it's good to know what was causing it.