Thanks to visit codestin.com
Credit goes to github.com

Skip to content

asking terminal for dimensions during every frame is expensive #11504

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

Merged
merged 3 commits into from
Mar 11, 2025

Conversation

SimaTian
Copy link
Member

@SimaTian SimaTian commented Feb 26, 2025

Part of #11160

Context

While profiling some of Eric's PRs and one of my experiments, I've noticed following:
terminall_loger_get_width_height_cost
Terminal width/height are behind a lock and repeated access is quite expensive.

Changes Made

I've set it so that the update is happening only once every ~second or so. This makes the cost negligible.
Note that this appears to be ~1.5% CPU time saved on the main node, which is the one under heaviest load due to IPC with all the other nodes.

Testing

None, this should be non-disruptive change.

Notes

Refresh frequency is up to discussion. Making it twice a second should be fine as well.

@SimaTian SimaTian requested a review from baronfel March 4, 2025 08:04
@SimaTian SimaTian requested a review from MichalPavlik March 11, 2025 15:14
@SimaTian SimaTian merged commit 0427e85 into main Mar 11, 2025
10 checks passed
@SimaTian SimaTian deleted the terminal_logger_dimensions_perf branch March 11, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants