Repository navigation
perf(rendering): reshape captions only when their text or style changes (up to 7.6x faster) - #2526
Merged
richiemcilroy merged 3 commits intoOct 20, 2026
Conversation
Contributor
|
Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This was referenced Oct 13, 2026
notkainoa
marked this pull request as ready for review
October 14, 2026 16:57
notkainoa
force-pushed
the
perf/caption-overlay-shape-cache
branch
from
October 14, 2026 19:34
3f37e77 to
a496dab
Compare
Member
|
@greptileai review |
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.
Captions are up to 7.6x cheaper per frame. The captions layer rebuilt and reshaped the caption on every frame, even though in most styles the text and color stay the same for the whole segment. Now it keeps the shaped text and reshapes only when it changes.
Means: default 55.4 → 11.9 µs, pill 60.1 → 16.0 µs, outline 80.5 → 36.8 µs, color highlight 63.9 → 64.3 µs.
Runs on every frame of GPUI editor playback and export of any recording with captions.
What changed
main. Those frames are the remaining p95.Output is unchanged
mainwith perf(rendering): reuse shaped text overlay layouts between frames (6.7-8.2x faster) #2524, perf(rendering): reshape the keyboard overlay only when its text changes (2.8x faster) #2525 and perf(rendering): reshape captions only when their text or style changes (up to 7.6x faster) #2526 applied together. Covers all 14 text animations, text styles, mid-playback edits, keyboard and caption styles, playback, backward scrubbing, random seeks, pauses and resizes. A planted cache-key bug makes thousands of frames differ, so the check catches mistakes.cargo test -p cap-rendering --release --lib: 305 passed on currentmain. The GPU tests pass with--include-ignored.cargo clippy -p cap-rendering --all-targets -- -D warningsandcargo fmtare clean.Benchmark setup
CaptionsLayer::prepareat 1920×1080: 4 spoken sentences at 60 fps. One warmup pass, then 3 measured passes pooled (824 visible frames per pass, 2,472 total). Each number is the median of 3 runs. Apple M1, release build, opt-level 3. "Before" is the same benchmark onmain(3d19c5c).CARGO_PROFILE_RELEASE_OPT_LEVEL=3 cargo test -p cap-rendering --release --lib benchmark_captions_layer_prepare -- --ignored --nocapture

Confidence Score: 5/5
The PR appears safe to merge; no actionable defects remain.Summary
Keeps shaped caption text between frames and rebuilds it when the text or style changes.
The previous and current commits have different merge bases with the target commit, so this review used the full PR diff.
Reviews (2) · Last reviewed commit: "test(rendering): check the caption layou..." · Reviewed by Greptile