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
Optimize CPU when Window is Hidden or Minimized #875
Comments
I've never caught mintty using any significant CPU: only a few % doing cat /var/log/*, and it drops when the window is obscured. What type of content are you displaying, what CPU are you running on, and how are you measuring this? If you are displaying a lot of exotic Unicode scripts, unassigned glyphs looking up fallbacks, escape sequences, or the like, rendering could be slower. Some tools can report CPU used by child processes and threads consolidated up to the parent: this may be what you're seeing. Use a tool or option that breaks down the CPU displayed by that consumed by each process or thread. You could run the process to write the log in the background, and use xtail to track log progess in the foreground. |
It might be possible to suspend the timer-driven window display updating while the window is hidden but mintty would still need to process the actual terminal output. But as Brian says, both is unlikely to be the culprit and it would be needed to demonstrate a case of mintty actually consuming much CPU time to establish whether it's worth the effort. |
I am display plain ASCII text. I am running on an Intel Core i5-7300U. I am measuring this by looking at Process Explorer. It shows the CPU usage of each process running on the system. It only reports the CPU usage of the process and does not add in the CPU usage of the child processes. That is a good idea to write the log in the background and tail in the foreground. I generated a random file with Here is the output from Process Explorer with the mintty window showing while executing Here is the output from Process Explorer with the mintty window minimized while executing The above emulates what I was seeing while executing |
If you feed unlimited input at maximum speed into the terminal, it's not surprising that it uses a maximum of CPU load to swallow it. Same with xterm. |
In the screenshot, the processes icons looks like compressed (small blue arrows). Are you running those from a compressed drive? |
Running minimized during output saves ~10% elapsed time already. |
With option |
Released 3.0.1. |
I am doing a long operation with
tee
to see the progress. So far 60 GB of text was written to the console. I noticed that mintty.exe consumes 20% CPU on a 4 logical core machine. If I minimize the mintty window or put another window in front of mintty, mintty still consumes 20% CPU.Please optimize mintty to not use as much CPU when the window is hidden. Ideally, mintty would simply copy stdout from
tee
to an in-memory buffer and do nothing more. Then when the mintty window is displayed, mintty will consume CPU time to render the screen.This is a trick that Windows Command Prompt does. It significantly speeds up long operations.
The text was updated successfully, but these errors were encountered: