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

High CPU Usage #6155

Closed
kdpuvvadi opened this issue May 23, 2020 · 11 comments
Closed

High CPU Usage #6155

kdpuvvadi opened this issue May 23, 2020 · 11 comments
Labels
Area-Performance Performance-related issue Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.

Comments

@kdpuvvadi
Copy link

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)

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 23, 2020
@skyline75489
Copy link
Collaborator

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

@kdpuvvadi
Copy link
Author

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?

@zadjii-msft
Copy link
Member

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 zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label May 28, 2020
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jun 1, 2020
@ghost
Copy link

ghost commented 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.

@kdpuvvadi
Copy link
Author

What exactly what me to run?

@ghost ghost 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 No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Jun 2, 2020
@zadjii-msft
Copy link
Member

What if you just repeat the steps from this #1064 (comment)?

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 zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jun 5, 2020
@kdpuvvadi
Copy link
Author

here the result

CMD:

image

image

Powershell:

image

image

Ubuntu Bash:

image

image

@ghost ghost 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 5, 2020
@zadjii-msft
Copy link
Member

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 zadjii-msft added Area-Performance Performance-related issue Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-Terminal The new Windows Terminal. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jun 16, 2020
@kdpuvvadi
Copy link
Author

kdpuvvadi commented 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

@ghost ghost 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 16, 2020
@DHowett
Copy link
Member

DHowett commented 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 DHowett added Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 26, 2020
@kdpuvvadi
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Performance Performance-related issue Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons.
Projects
None yet
Development

No branches or pull requests

4 participants