Repository navigation
feat(text): pace the stream fade to how fast chunks arrive - #7
Merged
Merged
Conversation
A fixed fade pulsed chunk by chunk on a fast stream and finished long before the next chunk on a slow one. With `TextViewMotion::with_stream_fade_pacing(min, max)`: - each update fades over three times the running average of the gaps between updates (weight 0.3), kept between `min` and `max`; - `stream_fade` still turns the fade on and times the first update; - a pause counts as the longest gap the bounds follow, so the pace returns within a few updates; - an update parsed with others already waiting fades 1.3 times faster for each (up to eight), so a backlog catches up; - the stagger compresses against the paced fade, and a replaced text starts its pace afresh. The idea follows Waku's veil as described, rewritten without its (GPL) code. Reduced motion still drops the fade. Each segment keeps its own duration and is sampled directly rather than through a `Timing`: `paced_fade_frame_bench` (300 words mid-fade, release, median of 9) goes from 21.2 to 12.1 us per frame, paced or not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
The stream fade runs for a fixed duration. On a fast stream it pulses chunk by chunk, and on a slow one it finishes long before the next chunk lands, so the text arrives in visible steps.
TextViewMotion::with_stream_fade_pacing(min, max)paces the fade to the stream instead:[min, max].stream_fadestill turns the fade on and sets the duration of the first update, when there is no gap yet to go by.[min/3, max/3]before it is averaged, so a pause (a model thinking) counts as the longest gap the bounds can follow. The pace comes back within a few updates once the stream resumes.revision - committed revision) fades 1.3 times faster per waiting update, up to 8, so a backlog catches up.The idea comes from Waku's veil (GPL). It was rewritten from a description of its behaviour, and none of its code was read or copied. The existing tracker already re-veils only the changed suffix after a reparse, so that part was not needed.
Each fade segment now keeps its own duration and is sampled directly, without building a
Timing.Docs:
website/base/text-view.mdand its zh-CN twin.Numbers
paced_fade_frame_bench: 300 words mid-fade, release build with debug assertions (gpui-fast bb5991c fails to build in plain release), median of 9 rounds.Timing)Timingper segment (first try)Tests
Eight tracker-level tests in
stream_fade.rs(tests::pacing), on real parsed documents with chosen timestamps:minand a slow one atmax;Checks:
cargo test -p gpui-base --lib: 1338 passed.cargo clippy -p gpui-basereports nothing in the touched files. Its existingtoo_many_argumentserrors elsewhere are unchanged from main.Not in this PR:
request_animation_framewaits on a frame-time measurement on a long transcript.TextView::stream_fade(true)keeps its fixed timing. Slopty passes.motion(..)with pacing.Upstream checked first: longbridge/gpui-kit has no open stream-fade PR.
🤖 Generated with Claude Code