feat(tui): add OPENCODE_EXPERIMENTAL_FPS for RDP/remote session performance#13814
Open
CoolCold wants to merge 1 commit intoanomalyco:devfrom
Open
feat(tui): add OPENCODE_EXPERIMENTAL_FPS for RDP/remote session performance#13814CoolCold wants to merge 1 commit intoanomalyco:devfrom
CoolCold wants to merge 1 commit intoanomalyco:devfrom
Conversation
…rmance OpenCode TUI runs at 60 FPS by default, which can cause performance issues when used over RDP (Remote Desktop Protocol). This change allows users to reduce the FPS via the OPENCODE_EXPERIMENTAL_FPS environment variable. Usage: OPENCODE_EXPERIMENTAL_FPS=15 opencode Key technical detail: OpenTUI has TWO FPS settings: - targetFps: The goal/aim (can render faster if there's pending work) - maxFps: The hard cap (absolute maximum, cannot exceed) Initially only targetFps was set, which allowed FPS to still spike. Now BOTH are set to the user-specified value to truly cap the FPS. Files changed: - src/config/config.ts: Added fps field to TUI schema (for future config file support, not yet wired up) - src/flag/flag.ts: Added OPENCODE_EXPERIMENTAL_FPS flag parsing - src/cli/cmd/tui/app.tsx: Changed render options to use the flag For reference, OpenTUI source is at /home/ubuntu/gits/opentui, specifically packages/core/src/renderer.ts lines 88-89, 324, 351-352.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #13817
What does this PR do?
When working on powerful remote machine over RDP (XRDP) I could see that it become laggy and xrdp consumes CPU. After some back and forth, I've assumed it may be to high refresh rate and it seems to be so - once I've set rps to 5, xrdp CPU consumption became much lower.
As well, when working over ssh - which is quite standard thing too, having high FPS doesn't make much sense, i.e. over 250-300 ms link, what kind of RPS you may expect :)
How did you verify your code works?
I've build local package, enabled debug information ( Ctrl+P -> Toggle Debug ) , watched FPS is limited while producing some output. In the other terminal, I was watching
topfor xrdp.Tests seems to pass too.
Detailed Description
OpenCode TUI runs at 60 FPS by default, which can cause performance issues when used over RDP (Remote Desktop Protocol). This change allows users to reduce the FPS via the OPENCODE_EXPERIMENTAL_FPS environment variable.
Usage:
OPENCODE_EXPERIMENTAL_FPS=15 opencode
Key technical detail: OpenTUI has TWO FPS settings:
Initially only targetFps was set, which allowed FPS to still spike. Now BOTH are set to the user-specified value to truly cap the FPS.
Files changed:
For reference, OpenTUI source is at /home/ubuntu/gits/opentui, specifically packages/core/src/renderer.ts lines 88-89, 324, 351-352.
Questions to maintainers
I think that
docs/removeme-after-merge/todo/todo.lower-fps-settings-findings.mdshould be deleted, leaving it for review - let me know how to proceed better here