ui: reduce per-token render cost when streaming #26053
Conversation
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
Assisted-by: Claude Opus 4.8
|
Hi @zachwinter, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
|
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 |
|
I'll take a look at that too |
There was a problem hiding this comment.
@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
left a comment
There was a problem hiding this comment.
LGTM to rework with Allozaur (follow-up)
aye! apologies, I missed your last comments. |
|
To be verified: the load with 256K tokens as well |
|
@ServeurpersoCom the rendering performance should be independent from token count at this point – that was my north star. empiricism always wins, though! |
|
@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 |
@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. |
Overview
This pull request addresses rendering performance issues I identified in the
llama-serverUI. This builds on top of the existing work in #25225. I have an additional PR ready, pending this one.e8a65bc adds a performance harness, used to ground the remaining work
6468958
CollapsibleContentBlock/CollapsibleTerminalBlock:210.36ms->2.67ms5346788
MarkdownContent+utils/code.ts:11.58ms->0.62msda06dca
LaTeXprotection:22.02ms->3.33ms1023641 conversation store update-in-place:
3.07ms->1.36ms(@ 40 messages)Additional information
This is a pure UI fix (no
.cpp).Requirements