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

Printing unicode characters is about 20x slower than usual characters #15625

Closed
tigrouind opened this issue Jun 28, 2023 · 6 comments
Closed
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@tigrouind
Copy link

tigrouind commented Jun 28, 2023

Windows Terminal version

1.17.11461.0

Windows build number

10.0.22621.1848

Other Software

using System;
using System.Diagnostics;

namespace ConsoleApp1
{
	internal class Program
	{
		static void Main()
		{
			Stopwatch sw = new Stopwatch();

			sw.Restart();
			for (int i = 0; i < 100; i++)
			{
				for (int j = 0; j < 100; j++)
				{
					Console.Write('.');
				}
				Console.WriteLine();
			}				
			sw.Stop();
			Console.WriteLine(sw.ElapsedMilliseconds);

			sw.Restart();
			for (int i = 0; i < 100; i++)
			{
				for (int j = 0; j < 100; j++)
				{
					Console.Write('▓');
				}
				Console.WriteLine();
			}
			sw.Stop();
			Console.WriteLine(sw.ElapsedMilliseconds);
		}
	}
}

Steps to reproduce

Print unicode characters to the console. Eg: U+2593 DARK SHADE

Here are benchmark results from C# application listed above.

Windows 11 Terminal (Ryzen 5700x / 1080TI GPU) :

Dot character : 108 ms
DARK SHADE : 2441 ms

Windows 10 command line (slower computer) :

Dot character : 311 ms
DARK SHADE : 314 ms

Expected Behavior

Rendering is just as fast as other characters

Actual Behavior

Rendering is very slow (it looks like it freeze temporarily when printing such characters).
Even after printing unicode characters, scrolling the area where they appear is slow.

@tigrouind tigrouind added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 28, 2023
@lhecker
Copy link
Member

lhecker commented Jun 28, 2023

Before I debug this, could you try and see if it improves if you enable "AtlasEngine" in the "Rendering" settings? After enabling it you'll have to restart the application or create new tabs.

@DHowett
Copy link
Member

DHowett commented Jun 28, 2023

It might also be worth testing your workload in Windows Terminal Preview v1.18 (don't worry, it doesn't overwrite your existing terminal install) as well. We've been working on the backing buffer and rendering performance for Unicode 😄

You can still try this, but this isn't "non-BMP unicode" so it is less likely to be impacted by the TextBuffer changes!

@DHowett DHowett added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 28, 2023
@tigrouind
Copy link
Author

tigrouind commented Jun 28, 2023

Before I debug this, could you try and see if it improves if you enable "AtlasEngine" in the "Rendering" settings? After enabling it you'll have to restart the application or create new tabs.

I didn't know such parameters existed. It improves performance a lot. Here are the results :

Non unicode : 112ms
Unicode : 109ms

The "Use software rendering" option also improves performance (but Unicode is still a little slower):

Non unicode : 116ms
Unicode : 210ms

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jun 28, 2023
@tigrouind
Copy link
Author

It might also be worth testing your workload in Windows Terminal Preview v1.18 (don't worry, it doesn't overwrite your existing terminal install) as well. We've been working on the backing buffer and rendering performance for Unicode 😄

You can still try this, but this isn't "non-BMP unicode" so it is less likely to be impacted by the TextBuffer changes!

I've tried it and it's just as fast as "AtlasEngine".

@lhecker
Copy link
Member

lhecker commented Jun 28, 2023

I'm glad AtlasEngine fixes the issue. Windows Terminal Preview already has it enabled by default. We plan to make it the default option in non-Preview in version 1.18 or 1.19.

I'll close the issue as a duplicate of #6974 then. /dup #6974

@microsoft-github-policy-service
Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants