Skip to content

perf(codemode): cache unchanged rendered frames - #2061

Merged
dnlrsls merged 1 commit into
mainfrom
perf/codemode-frame-cache
Oct 10, 2026
Merged

dnlrsls merged 1 commit into
mainfrom
perf/codemode-frame-cache

Conversation

@dnlrsls

@dnlrsls dnlrsls commented Oct 10, 2026

Copy link
Copy Markdown
Member

Linked issue

Refs #2017

PR type

  • Bug fix
  • New feature
  • Documentation only
  • Code refactoring
  • Maintenance/tooling
  • Breaking change

Summary

  • Reuse a single rendered frame per Codemode card when normalized width, card style and computed running state are unchanged.
  • Clear cached frames on component invalidation; result arrival still recomputes the running call frame.
  • Preserve exact ANSI output and fresh partial, final and expanded components without changing shared wrapping or execution.

Changes

File Change
lib/codemode-renderer.ts Single-entry per-component rendered-frame cache and invalidation.
tests/codemode-rendering.test.ts Four public-renderer regressions for reuse, layout/theme changes, result transitions and content freshness.

Test plan

  • RED observed against the original renderer: unchanged renders duplicated painting (22 vs 11).
  • node --experimental-strip-types --test tests/codemode-rendering.test.ts tests/quiet-tool-rendering.test.ts tests/shell-card.test.ts: 127 passed, 0 failed.
  • Independent verifier: node --experimental-strip-types --test tests/codemode-rendering.test.ts: 32 passed, 0 failed.
  • pnpm typecheck: zero diagnostics in the local working tree.
  • git diff --cached --check: passed before commit.
  • Native assessment of this committed range: medium; reviewDue=false.
  • Full package suite is not locally approved: the Windows run produced failures in other areas and was stopped without a final summary. These failures were not all classified as baseline.
  • Whole-session latency, long-running retention and a Linux baseline/candidate run were not measured. CI remains pending.
  • ShellCheck and changed-skill checks: not applicable; no scripts or skills changed in this PR.

Scope

Only commit 18ee9511a is included (two files, 117 additions / 4 deletions). Separate Windows fixture and launcher-timeout changes remain uncommitted locally and are excluded. This cache removes repeated layout work, not first-render cost or the source of render requests.

Contributor checklist

  • Linked issue has status:approved.
  • Exactly one PR type selected; matching type:bug label requested.
  • Conventional commit with tests alongside behavior; no Co-Authored-By trailer.
  • Applicable focused and independent checks observed.
  • No public command, option, message or configuration contract changed.
  • Required CI passed.

Reuse per-card frames across unchanged renders and invalidate on layout, style, or running-state changes.

Refs #2017
@dnlrsls dnlrsls added the type:bug Bug fix label Oct 10, 2026
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 18671562-e5f3-49a3-a25a-76cb91db04e5

📥 Commits

Reviewing files that changed from the base of the PR and between 563fede and 18ee951.


📒 Files selected for processing (2)
  • lib/codemode-renderer.ts
  • tests/codemode-rendering.test.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dnlrsls
dnlrsls merged commit a3f5b91 into main Oct 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant