Skip to content

ui: reduce per-token render cost when streaming #26053

Merged
allozaur merged 5 commits into
ggml-org:masterfrom
zachwinter:ui/streaming-perf-pr1
Jul 24, 2026
Merged

ui: reduce per-token render cost when streaming #26053
allozaur merged 5 commits into
ggml-org:masterfrom
zachwinter:ui/streaming-perf-pr1

Conversation

@zachwinter

Copy link
Copy Markdown
Contributor

Overview

This pull request addresses rendering performance issues I identified in the llama-server UI. This builds on top of the existing work in #25225. I have an additional PR ready, pending this one.

All millisecond measurements are per streamed token.

e8a65bc adds a performance harness, used to ground the remaining work
6468958 CollapsibleContentBlock / CollapsibleTerminalBlock: 210.36ms -> 2.67ms
5346788 MarkdownContent + utils/code.ts: 11.58ms -> 0.62ms
da06dca LaTeX protection: 22.02ms -> 3.33ms
1023641 conversation store update-in-place: 3.07ms -> 1.36ms (@ 40 messages)

Additional information

This is a pure UI fix (no .cpp).

Requirements

  • I have read and agree with the contributing guidelines: YES, and I'm still anxious I missed something (plz tell me).
  • AI usage disclosure: I drove Opus for these fixes; I've been a UI Engineer by trade since 2009. Happy to remove the code comments if y'all would prefer it.

Zach Winter added 5 commits July 23, 2026 11:54
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
@zachwinter
zachwinter requested a review from a team as a code owner July 23, 2026 20:55
@ggml-gh-bot

ggml-gh-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

Hi @zachwinter, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • Large PR: Large changes require prior discussion (e.g. an issue or RFC) and maintainers may not be able to review this PR as-is. Consider splitting it into smaller, focused PRs.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@zachwinter zachwinter changed the title [fix] UI Rendering Performance ui: reduce per-token render cost when streaming Jul 23, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation server/ui labels Jul 23, 2026
@allozaur

Copy link
Copy Markdown
Contributor

hey, thanks for this contribution! i had it planned to address this shortly, so that's a good timing :D lemme check it and get back to u

@ServeurpersoCom ServeurpersoCom self-assigned this Jul 24, 2026
@ServeurpersoCom

Copy link
Copy Markdown
Contributor

I'll take a look at that too

@allozaur allozaur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachwinter i think the comments are good to stay for now, i think we will still re-visit some parts of how we render the UI so it's good for context.

Please merge my PR to your branch with few improvements — zachwinter/pull/1

@allozaur

Copy link
Copy Markdown
Contributor

@zachwinter i think the comments are good to stay for now, i think we will still re-visit some parts of how we render the UI so it's good for context.

Please merge my PR to your branch with few improvements — zachwinter/pull/1

actually, closing this and will post a follow-up PR

@ServeurpersoCom ServeurpersoCom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to rework with Allozaur (follow-up)

@zachwinter

Copy link
Copy Markdown
Contributor Author

@zachwinter i think the comments are good to stay for now, i think we will still re-visit some parts of how we render the UI so it's good for context.

Please merge my PR to your branch with few improvements — zachwinter/pull/1

actually, closing this and will post a follow-up PR

aye! apologies, I missed your last comments.

@ServeurpersoCom

Copy link
Copy Markdown
Contributor

To be verified: the load with 256K tokens as well

@zachwinter

Copy link
Copy Markdown
Contributor Author

@ServeurpersoCom the rendering performance should be independent from token count at this point – that was my north star. empiricism always wins, though!

@allozaur

Copy link
Copy Markdown
Contributor

@zachwinter i guess let's proceed regardless, i will reference this PR in the follow-up one

@allozaur
allozaur merged commit 555881e into ggml-org:master Jul 24, 2026
6 checks passed
@zachwinter

Copy link
Copy Markdown
Contributor Author

@zachwinter i guess let's proceed regardless, i will reference this PR in the follow-up one

hard to understate my excitement. hashtag first merge!

I will tee up my second round shortly!

@allozaur

Copy link
Copy Markdown
Contributor

@zachwinter i guess let's proceed regardless, i will reference this PR in the follow-up one

hard to understate my excitement. hashtag first merge!

I will tee up my second round shortly!

no worries i'm pushing from my branch and will post a PR in a moment

@zachwinter

Copy link
Copy Markdown
Contributor Author

@ServeurpersoCom the rendering performance should be independent from token count at this point – that was my north star. empiricism always wins, though!

@ServeurpersoCom sorry, this comment is true, given this: #26098

@ServeurpersoCom

Copy link
Copy Markdown
Contributor

@ServeurpersoCom the rendering performance should be independent from token count at this point – that was my north star. empiricism always wins, though!

@ServeurpersoCom sorry, this comment is true, given this: #26098

cc @allozaur

I’ll do a full review at the end: I approved it without benchmark (only a non regression quick test with a prompt like "Create a long, feature-rich Markdown demo to stress-test my streaming Markdown rendering engine. You never stop!!! Seriously, never! Throw in some KaTeX, too like a crazy math teacher!!!!") to let allozaur move forward, but I’ll conduct a comprehensive analysis at the end regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation server/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants