Skip to content

Optimize Rich Live line-count hot path + document long-response fallback#134

Merged
chauncygu merged 1 commit into
mainfrom
rich-live-streaming
Jun 4, 2026
Merged

Optimize Rich Live line-count hot path + document long-response fallback#134
chauncygu merged 1 commit into
mainfrom
rich-live-streaming

Conversation

@chauncygu
Copy link
Copy Markdown
Contributor

Follow-up to the long-response Rich Live fallback (PR #133).

ui/render.py: _rendered_line_count now uses a cheap per-line wrap estimate to short-circuit the expensive full console.render_lines() measurement while a response stays comfortably under the limit. Normal responses no longer pay an extra full Markdown re-render on every streamed chunk (was O(n^2) on the hot path); the precise render only runs as output nears the fallback limit. On render failure it now falls back to the cheap estimate instead of 0 so oversized content still triggers the plain-streaming fallback.

Docs: document the automatic per-response plain-streaming fallback (wrap- / terminal-height aware) across README News, docs/news.md, features.md, advanced.md, and the 7 i18n READMEs.

Follow-up to the long-response Rich Live fallback (PR #133).

ui/render.py: _rendered_line_count now uses a cheap per-line wrap estimate
to short-circuit the expensive full console.render_lines() measurement while
a response stays comfortably under the limit. Normal responses no longer pay
an extra full Markdown re-render on every streamed chunk (was O(n^2) on the
hot path); the precise render only runs as output nears the fallback limit.
On render failure it now falls back to the cheap estimate instead of 0 so
oversized content still triggers the plain-streaming fallback.

Docs: document the automatic per-response plain-streaming fallback (wrap- /
terminal-height aware) across README News, docs/news.md, features.md,
advanced.md, and the 7 i18n READMEs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chauncygu chauncygu merged commit bda91fb into main Jun 4, 2026
6 checks passed
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.

1 participant