terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Terminal becomes extremely laggy after printing large amount of CJK characters

Open fireattack opened this issue 1 year ago • 4 comments

Windows Terminal version

1.20.11381.0

Windows build number

10.0.19045.4412

Other Software

No response

Steps to reproduce

s = '打印一个非常长的中文句子,啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊'
for _ in range(100):
    print(s)
var s = '打印一个非常长的中文句子,啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊'
for (var i = 0; i < 100; i++) {    console.log(s)    }

Run any of the above script (python or node) in a WT tab.

Expected Behavior

It prints all the lines very quickly and you can scroll the window with ease.

Actual Behavior

It becomes very laggy (takes seconds to print the whole thing) and after printing, the whole window becomes very laggy, you can barely scroll back and forth.


So, this problem is tricky because I can't find a reliable way to reproduce it. All I can confirm is that:

The issue only started to happen in recent months.

It usually starts to happen after I use my computer for extended time (I leave my computer on 24/7). And once it started to appear, it will affect all the Terminal windows, old or new. And it does not matter which type, can reproduce in CMD, PS, PS7 etc.

Furthermore, once the bug appears, the only way I can fix it is by restarting my computer.

It only happens when printing large amount CJK characters (Chinese, Japanese, etc.). Printing ASCII characters are fine.

fireattack avatar Jun 09 '24 15:06 fireattack

  1. Close all instances of Windows Terminal.
  2. Delete the settings file located at %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json.
  3. Restart Windows Terminal, which will generate a new settings file with default settings.

bitsgorilla avatar Jun 10 '24 08:06 bitsgorilla

You may be running out of GPU memory. The next time this happens can you check your GPU memory usage in Task Manager?

lhecker avatar Jun 10 '24 22:06 lhecker

Can you confirm whether you are using the "new text rendering engine", or whether you have it disabled? Version 1.20 will be the last version with the old text rendering engine, so it will be important to know if the issue is with the new one.

DHowett avatar Jun 12 '24 20:06 DHowett

Yes, I'm using the new "AtlasEngine":

2024-06-13

As for GPU memory, I think it's unlikely since I have a 16GB RTX 4060Ti, but I can check it next time this happened.

The full settings.json is also attached but nothing unusual.

fireattack avatar Jun 13 '24 01:06 fireattack

@fireattack Any updates? Has this occurred again over the past few weeks /?

carlos-zamora avatar Jul 03 '24 21:07 carlos-zamora

@carlos-zamora no, i didn't see it happen lately (granted, i didn't use it heavily either).

fireattack avatar Jul 04 '24 01:07 fireattack

Thanks! We're going to close this bug, but happy to reopen it if you see it again. Just let us know 😊

carlos-zamora avatar Jul 10 '24 21:07 carlos-zamora

This is happening again. Version: 1.21.2911.0

https://github.com/user-attachments/assets/663ee07f-9640-4c20-a6f6-5f3e4debeff5

Rendering setting:

Image

GPU memory is fine: Image

fireattack avatar Oct 25 '24 18:10 fireattack

But you still can't reliably reproduce the issue, right? It only happens sporadically? Do you happen to have a G-Sync or FreeSync monitor?

lhecker avatar Nov 04 '24 18:11 lhecker

That's right. Once it happens, it usually stays that way until I restart my computer.

No, I don't have these *sync monitors. I do have dual-monitors with one being a cheap 4k 60Hz panel (from laptop) and another 2k 75Hz one.

fireattack avatar Nov 05 '24 00:11 fireattack

I'm not sure if I'll be able to help you with the issue. It's one of these cases where I'd need to get your hardware into my hands so that I can install Superluminal on it and get a timeline trace right when it happens.

That aside, please make sure that you update all your drivers, in particular the Nvidia driver (your version has a severe security vulnerability). Try to change the "Graphics API" setting to Direct3D and enable the "Disable partial swap chain invalidation" setting below it.

If you want to investigate this issue further, would you be willing to compile this project yourself from one of my custom branches and run some tests once it happens again?

lhecker avatar Nov 05 '24 00:11 lhecker

Sure, feel free to link your custom branch so I can try it if it ever happens again (together with all your other suggestions.) I can't guarantee I'm capable to make it work. :P

Also I have updated my driver to newest since the last post (and the bug then hasn't happened), but thanks for the reminder.

fireattack avatar Nov 05 '24 01:11 fireattack

That aside, please make sure that you update all your drivers, in particular the Nvidia driver (your version has a severe security vulnerability). Try to change the "Graphics API" setting to Direct3D and enable the "Disable partial swap chain invalidation" setting below it.

Last time this happened, I tried to toggle everything in Rendering, no difference.


I also have a somewhat related case to this issue.

I remote desktop to my home computer frequently.

I noticed that, sometimes, when I started using my computer in-person after some remote sessions, the whole UI on Windows desktop becomes extremely laggy (dragging windows, switch windows, you name it) to a point it feels like <20fps.

To fix this, I have to turn off all Windows Terminal windows I left open (I usually have 2 to 3 open all the time), and this issue is immediately gone.

I feel like this must be related to this issue.

For what it's worth, I have 2 monitors (1 2k 75hz, 1 4k 60hz).

fireattack avatar Dec 12 '24 14:12 fireattack