High CPU Usage #8520

Closed
opened 2026-01-31 01:31:30 +00:00 by claunia · 11 comments
Owner

Originally created by @kdpuvvadi on GitHub (May 23, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.836]
Windows Terminal version (if applicable): 1.0.1401.0

Any other software?

Steps to reproduce

Created a Directory, CDing into that Directory. Create couple of Folders and add 10 files to both folders. run Tree Command

Expected behavior

Display Folder structure

Actual behavior

Displayed the Structure but High CPU usage aroung 60% on dual core i7-6500u (Lenovo Ideapad 310) and 50% on 6 core i7-8750h (Alienware 17 R5)

Originally created by @kdpuvvadi on GitHub (May 23, 2020). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18363.836] Windows Terminal version (if applicable): 1.0.1401.0 Any other software? ``` # Steps to reproduce Created a Directory, CDing into that Directory. Create couple of Folders and add 10 files to both folders. run Tree Command # Expected behavior Display Folder structure # Actual behavior Displayed the Structure but High CPU usage aroung 60% on dual core i7-6500u (Lenovo Ideapad 310) and 50% on 6 core i7-8750h (Alienware 17 R5)
Author
Owner

@skyline75489 commented on GitHub (May 25, 2020):

Based on the very CPU usage, I gotta assume that you're using HiDPI/Acrylic/large screen. Is any of these true?

@skyline75489 commented on GitHub (May 25, 2020): Based on the very CPU usage, I gotta assume that you're using HiDPI/Acrylic/large screen. Is any of these true?
Author
Owner

@kdpuvvadi commented on GitHub (May 25, 2020):

No, On the Alienware it's 1920x1080 non gsync panel and on ideapad end it's 1366x768 display

Based on the very CPU usage, I gotta assume that you're using HiDPI/Acrylic/large screen. Is any of these true?

@kdpuvvadi commented on GitHub (May 25, 2020): No, On the Alienware it's 1920x1080 non gsync panel and on ideapad end it's 1366x768 display > Based on the very CPU usage, I gotta assume that you're using HiDPI/Acrylic/large screen. Is any of these true?
Author
Owner

@zadjii-msft commented on GitHub (May 28, 2020):

Hmm, that's certainly weird. Could you do something that's not disk i/o bound to check if that's what's causing this? tree needs to hit the disk to print it's output, but maybe if you captured the output to a file and just tried type-ing that file to the console it'll be faster?

That might at least help narrow the problem down.

@zadjii-msft commented on GitHub (May 28, 2020): Hmm, that's certainly weird. Could you do something that's not disk i/o bound to check if that's what's causing this? `tree` needs to hit the disk to print it's output, but maybe if you captured the output to a file and just tried `type`-ing that file to the console it'll be faster? That might at least help narrow the problem down.
Author
Owner

@ghost commented on GitHub (Jun 1, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jun 1, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@kdpuvvadi commented on GitHub (Jun 2, 2020):

What exactly what me to run?

@kdpuvvadi commented on GitHub (Jun 2, 2020): What exactly what me to run?
Author
Owner

@zadjii-msft commented on GitHub (Jun 5, 2020):

What if you just repeat the steps from this https://github.com/microsoft/terminal/issues/1064#issuecomment-618024330?

Get big.txt from https://norvig.com/big.txt

CMD command

set "startTime=%time%" && type big.txt && call echo started: %^startTime% finished: %^time%

PowerShell command

Measure-Command { Get-Content -ReadCount 0 big.txt | Out-Default }

Ubuntu Bash command

time cat big.txt
@zadjii-msft commented on GitHub (Jun 5, 2020): What if you just repeat the steps from this https://github.com/microsoft/terminal/issues/1064#issuecomment-618024330? Get big.txt from https://norvig.com/big.txt CMD command ``` set "startTime=%time%" && type big.txt && call echo started: %^startTime% finished: %^time% ``` PowerShell command ``` Measure-Command { Get-Content -ReadCount 0 big.txt | Out-Default } ``` Ubuntu Bash command ``` time cat big.txt ```
Author
Owner

@kdpuvvadi commented on GitHub (Jun 5, 2020):

here the result

CMD:

image

image

Powershell:

image

image

Ubuntu Bash:

image

image

@kdpuvvadi commented on GitHub (Jun 5, 2020): here the result CMD: ![image](https://user-images.githubusercontent.com/7326255/83880858-77af5d80-a75d-11ea-8c93-be87ad3625a5.png) ![image](https://user-images.githubusercontent.com/7326255/83880904-8a299700-a75d-11ea-9083-be647bb27720.png) Powershell: ![image](https://user-images.githubusercontent.com/7326255/83880988-a299b180-a75d-11ea-8cd8-dbecb0c31c37.png) ![image](https://user-images.githubusercontent.com/7326255/83881014-a88f9280-a75d-11ea-8b2e-6ce1cee86ae1.png) Ubuntu Bash: ![image](https://user-images.githubusercontent.com/7326255/83881039-b34a2780-a75d-11ea-9cd8-78499962454b.png) ![image](https://user-images.githubusercontent.com/7326255/83881056-b7764500-a75d-11ea-8c6c-10542c8d6a64.png)
Author
Owner

@zadjii-msft commented on GitHub (Jun 16, 2020):

Huh. This is certainly curious. I bet this will get better with the changes that have been made in 1.1, but I can't really be sure of that. It honestly looks like this might just be by design - it looks like the Ideapad doesn't have a dedicated GPU, so the rendering is all going to have to be done by the CPU.

Maybe it would be helpful to see which process in the WT tree is actually consuming all the CPU:
image

@zadjii-msft commented on GitHub (Jun 16, 2020): Huh. This is certainly curious. I _bet_ this will get better with the changes that have been made in 1.1, but I can't really be sure of that. It honestly looks like this might just be by design - it looks like the Ideapad doesn't have a dedicated GPU, so the rendering is all going to have to be done by the CPU. Maybe it would be helpful to see _which_ process in the WT tree is actually consuming all the CPU: ![image](https://user-images.githubusercontent.com/18356694/84791305-058a1480-afb8-11ea-8e14-94cca7608ba6.png)
Author
Owner

@kdpuvvadi commented on GitHub (Jun 16, 2020):

Well, i tested it on Alienware 17 with 8750H, it's pretty decent chip

image

and it's while running on ubuntu wsl

image
image

@kdpuvvadi commented on GitHub (Jun 16, 2020): Well, i tested it on Alienware 17 with 8750H, it's pretty decent chip ![image](https://user-images.githubusercontent.com/7326255/84798187-487bd480-b018-11ea-8fc2-12de3b6ea0b5.png) and it's while running on ubuntu wsl ![image](https://user-images.githubusercontent.com/7326255/84798377-80831780-b018-11ea-9af3-44354972b15a.png) ![image](https://user-images.githubusercontent.com/7326255/84798493-a6102100-b018-11ea-9ec8-2acaa192c77b.png)
Author
Owner

@DHowett commented on GitHub (Jun 26, 2020):

Thanks for the report! So, here's the thing.
I had a look at conhost, Terminal and gnome-terminal. All of them seem to use fairly high amounts of CPU when printing out insane amounts of text.

I think this is really just going to be par for the course. There's a lot of work to be done in text rendering 😄 even things that happen off the GPU, like glyph shaping and font handling and buffer management and stuff.

I'd love to see a performance trace, if anybody can get one, that shows why this is bad. 😄

We've explicitly made tradeoffs, sometimes, that use more CPU time to process things faster and queue them up for the slower steps of the pipeline. That's on purpose: if we can burst, get work done, and then have an easier time later we will often choose to do so.

There's a weird inflection point we hit sometimes where we clean up a slow part of the terminal and it goes faster, and it going faster means that we burn up cycles doing the thing you asked us to do with higher expenditure for a shorter time. I'm not sure that's bad; it likely evens out to "better in the long run"

For now, this is by-design. If it proves to be a bottleneck, however, I'd love to have that chat 😄

Thanks again!

@DHowett commented on GitHub (Jun 26, 2020): Thanks for the report! So, here's the thing. I had a look at conhost, Terminal and gnome-terminal. All of them seem to use fairly high amounts of CPU when printing out insane amounts of text. I think this is really just going to be par for the course. There's a lot of work to be done in text rendering :smile: even things that happen off the GPU, like glyph shaping and font handling and buffer management and stuff. I'd love to see a performance trace, if anybody can get one, that shows why this is bad. :smile: We've explicitly made tradeoffs, sometimes, that _use more CPU time_ to process things faster and queue them up for the slower steps of the pipeline. That's on purpose: if we can burst, get work done, and then have an easier time later we will often choose to do so. There's a weird inflection point we hit sometimes where we clean up a slow part of the terminal and it goes faster, and it going faster means that we burn up cycles doing the thing you asked us to do with higher expenditure for a shorter time. I'm not sure that's _bad_; it likely evens out to "better in the long run" For now, this is by-design. If it proves to be a bottleneck, however, I'd love to have that chat :smile: Thanks again!
Author
Owner

@kdpuvvadi commented on GitHub (Jun 26, 2020):

😄, anyhow i'm closing the issue. If i find anything to add i'll do that.

@kdpuvvadi commented on GitHub (Jun 26, 2020): 😄, anyhow i'm closing the issue. If i find anything to add i'll do that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8520