[PR #24949] [CLOSED] perf: reduce heavy chat rendering work #131607

Closed
opened 2026-05-21 17:18:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24949
Author: @noufalkv
Created: 5/20/2026
Status: Closed

Base: devHead: perf/tor-chat-rendering


📝 Commits (3)

  • 1d2ccce perf(renderer): reduce markdown and tool-call mount cost
  • 40346ff test(renderer): add pathological chat stress fixtures
  • d1f1c51 perf(chat): reduce high-latency load stalls

📊 Changes

8 files changed (+555 additions, -119 deletions)

View changed files

📝 package.json (+1 -1)
scripts/renderer-stress-cases.mjs (+237 -0)
scripts/renderer-stress-cases.test.mjs (+36 -0)
📝 src/lib/components/chat/Chat.svelte (+41 -21)
📝 src/lib/components/chat/Messages/CodeBlock.svelte (+86 -7)
📝 src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte (+75 -68)
📝 src/lib/components/common/ToolCallDisplay.svelte (+76 -19)
📝 src/routes/+layout.svelte (+3 -3)

📄 Description

Summary

  • Reduce expensive markdown/code/tool-call work during normal chat rendering.
  • Add renderer stress fixtures for heavy markdown, tool calls, streaming code, and ~1M-context long chats.
  • Parallelize independent chat-load probes and discard stale navigation loads to reduce high-latency stalls.

Why

This targets pathological chat histories and high-latency browsers, including Tor Browser/Firefox-family sessions where repeated markdown parsing, eager CodeMirror mounts, and nested tool-call rendering can make chats feel frozen.

This PR was prepared by an autonomous AI coding agent at a user's request. Please review it as an ordinary external contribution; no maintainer affiliation is implied.

Test Plan

  • git diff --check origin/dev...HEAD
  • Svelte compiler smoke checks for:
    • src/lib/components/chat/Chat.svelte
    • src/routes/+layout.svelte
    • src/lib/components/chat/Messages/CodeBlock.svelte
    • src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte
    • src/lib/components/common/ToolCallDisplay.svelte
  • npm run test:frontend
  • Built a local Open WebUI container image from this branch with USE_SLIM=true and verified /health on a live local deployment.

Review Notes

  • CodeMirror still mounts for edit mode; read-only code blocks use lighter rendering.
  • Large or actively streaming code blocks intentionally skip the expensive highlight path.
  • Tool-call payload parsing remains available, but is memoized and delayed so collapsed calls are cheaper.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24949 **Author:** [@noufalkv](https://github.com/noufalkv) **Created:** 5/20/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `perf/tor-chat-rendering` --- ### 📝 Commits (3) - [`1d2ccce`](https://github.com/open-webui/open-webui/commit/1d2ccce0047d1db52b20d6b3c520e551db883b94) perf(renderer): reduce markdown and tool-call mount cost - [`40346ff`](https://github.com/open-webui/open-webui/commit/40346ff482c016e99c5d0ce9838f45059f1291aa) test(renderer): add pathological chat stress fixtures - [`d1f1c51`](https://github.com/open-webui/open-webui/commit/d1f1c513f3fee6466239bd066facd12254457d4b) perf(chat): reduce high-latency load stalls ### 📊 Changes **8 files changed** (+555 additions, -119 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+1 -1) ➕ `scripts/renderer-stress-cases.mjs` (+237 -0) ➕ `scripts/renderer-stress-cases.test.mjs` (+36 -0) 📝 `src/lib/components/chat/Chat.svelte` (+41 -21) 📝 `src/lib/components/chat/Messages/CodeBlock.svelte` (+86 -7) 📝 `src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte` (+75 -68) 📝 `src/lib/components/common/ToolCallDisplay.svelte` (+76 -19) 📝 `src/routes/+layout.svelte` (+3 -3) </details> ### 📄 Description ## Summary - Reduce expensive markdown/code/tool-call work during normal chat rendering. - Add renderer stress fixtures for heavy markdown, tool calls, streaming code, and ~1M-context long chats. - Parallelize independent chat-load probes and discard stale navigation loads to reduce high-latency stalls. ## Why This targets pathological chat histories and high-latency browsers, including Tor Browser/Firefox-family sessions where repeated markdown parsing, eager CodeMirror mounts, and nested tool-call rendering can make chats feel frozen. This PR was prepared by an autonomous AI coding agent at a user's request. Please review it as an ordinary external contribution; no maintainer affiliation is implied. ## Test Plan - `git diff --check origin/dev...HEAD` - Svelte compiler smoke checks for: - `src/lib/components/chat/Chat.svelte` - `src/routes/+layout.svelte` - `src/lib/components/chat/Messages/CodeBlock.svelte` - `src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte` - `src/lib/components/common/ToolCallDisplay.svelte` - `npm run test:frontend` - Built a local Open WebUI container image from this branch with `USE_SLIM=true` and verified `/health` on a live local deployment. ## Review Notes - CodeMirror still mounts for edit mode; read-only code blocks use lighter rendering. - Large or actively streaming code blocks intentionally skip the expensive highlight path. - Tool-call payload parsing remains available, but is memoized and delayed so collapsed calls are cheaper. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-21 17:18:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#131607