[PR #21885] [MERGED] perf: throttle message list rebuild to once per animation frame during streaming #49370

Closed
opened 2026-04-30 01:40:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21885
Author: @Classic298
Created: 2/25/2026
Status: Merged
Merged: 2/28/2026
Merged by: @tjbck

Base: devHead: perf/throttle-messages-rebuild


📝 Commits (1)

  • acdb43a perf: throttle message list rebuild to once per animation frame during streaming

📊 Changes

1 file changed (+31 additions, -2 deletions)

View changed files

📝 src/lib/components/chat/Messages.svelte (+31 -2)

📄 Description

Messages.svelte rebuilds the message list by walking the parent chain and creating spread copies on every history.messages change. During streaming, this runs on every token — hundreds of times per second — even though each ResponseMessage already has its own reactive binding for content updates. Throttle the rebuild to once per animation frame (~60Hz) during content-only updates, while keeping immediate rebuilds for structural changes (currentId changes like chat switches, navigation, or new messages). Adds onDestroy cleanup for the pending rAF.

this is a completely invisible change - free lunch

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 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/21885 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 2/25/2026 **Status:** ✅ Merged **Merged:** 2/28/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `perf/throttle-messages-rebuild` --- ### 📝 Commits (1) - [`acdb43a`](https://github.com/open-webui/open-webui/commit/acdb43aa9f9ac15a191aeef76619728a20da4114) perf: throttle message list rebuild to once per animation frame during streaming ### 📊 Changes **1 file changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/Messages.svelte` (+31 -2) </details> ### 📄 Description Messages.svelte rebuilds the message list by walking the parent chain and creating spread copies on every history.messages change. During streaming, this runs on every token — hundreds of times per second — even though each ResponseMessage already has its own reactive binding for content updates. Throttle the rebuild to once per animation frame (~60Hz) during content-only updates, while keeping immediate rebuilds for structural changes (currentId changes like chat switches, navigation, or new messages). Adds onDestroy cleanup for the pending rAF. <ins>**this is a completely invisible change - free lunch**</ins> ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. --> By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <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-04-30 01:40:47 -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#49370