Repository navigation
⚡️ perf: bound concurrent stream fades and fold faded tail spans - #8
Merged
Merged
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
lobe-tsukumo Bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
## [1.4.6](v1.4.5...v1.4.6) (2026-11-19) ### ⚡ Performance Improvements * Bound concurrent stream fades and fold faded tail spans, closes [#8](#8) ([e67f932](e67f932))
|
🎉 This PR is included in version 1.4.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fast streams created one composited opacity animation per char or word. With bursty input this meant over a thousand concurrent layers. The cost landed on the compositor and GPU threads, not in JS. An 8K paragraph streamed in 256-char chunks used 1.6 s on the compositor thread, had a 233 ms frame p95, and left about 2,300 spans in the DOM after the stream ended. Word granularity also had a bug: after the first whitespace, every birth was
NaN. Those words never collapsed into text, so each word stayed a span for good.Changes
NaN.StreamTailre-renders itself once after its last fade, so the final commit of a stream no longer leaves spans behind.pnpm bench: a Chromium replay benchmark against@pierre/wordsandstreamdown(Vercel). It uses their fixtures plus generated long paragraphs and fences, and supports--throttlefor CPU slowdown. It measures main-thread time from CDP, frame p95, heap and final DOM size.Results
Main-thread ms, animated, median of 3 runs, Apple M4 Max, Chrome 157:
After the stream ends, 2–110 DOM elements remain, down from up to 3,400.
What to check
rehypeStreamAnimatedoutput items can now hold several chars or words, and faded chars are no longer.stream-charspans.Not changed
Smoothing pacing, block lexing and freezing, code fences, and the
prefers-reduced-motionrule.