Skip to content

feat(tui): add OPENCODE_EXPERIMENTAL_FPS for RDP/remote session performance#13814

Open
CoolCold wants to merge 1 commit intoanomalyco:devfrom
CoolCold:feature/tui-lower-fps-target
Open

feat(tui): add OPENCODE_EXPERIMENTAL_FPS for RDP/remote session performance#13814
CoolCold wants to merge 1 commit intoanomalyco:devfrom
CoolCold:feature/tui-lower-fps-target

Conversation

@CoolCold
Copy link
Copy Markdown

@CoolCold CoolCold commented Feb 16, 2026

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 top for 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:

  • 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.

Questions to maintainers

I think that docs/removeme-after-merge/todo/todo.lower-fps-settings-findings.md should be deleted, leaving it for review - let me know how to proceed better here

…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.
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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.

[FEATURE]: limit the FPS (frames per second) target rate, useful for remote work

1 participant