Repository navigation
perf(project): avoid cloning captions before projection - #2956
Merged
richiemcilroy merged 2 commits intoOct 23, 2026
Merged
richiemcilroy merged 2 commits into
richiemcilroy merged 2 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Contributor
|
@OptimistOtaku 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 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.
Caption synchronization clones every source caption and word into a temporary sanitized transcript before projecting any of it. A cut recording pays for thousands of string allocations even when most words are discarded. GPUI runs this path when synchronizing captions after timeline edits and when opening the editor.
Project directly from the borrowed source captions, applying the same
f32word-duration cap when calculating word bounds and overlaps. Only retained output words need their text cloned. Projects without clip mappings still return the same clamped captions. No cache, format, timing, or public API changes.Measurements
Existing
caption-projection-benchmarkexample, upstream1965b3179versus this change. Windows x86_64, Ryzen 5 5600H, Rust 1.88.0 GNU, repository release profile (opt-level=s, thin LTO). Five alternating process runs per version; medians of 25 samples per case, each averaging 50 synchronizations after warmups. All generated-track fingerprints match.These measure complete in-memory
synchronize_captions, including projection, override preservation, sorting, and output allocation. They exclude file loading, UI dispatch, and rendering; this is not an overall FPS or editor-startup claim.Reproduce the API comparison by building both revisions:
The committed ignored benchmark also compares projection directly against the exact old function, including reversed-clip controls:
cargo test -p cap-project --locked --release --lib benchmark_caption_projection_allocations -- --ignored --nocaptureValidation
cargo fmt --allcargo check -p cap-project --lockedcargo test -p cap-project --locked --lib: 168 passed, three benchmarks ignored by default.cargo clippy -p cap-project --all-targets --locked -- -D warningsgit diff --checkDifferential tests compare complete projection results, including float bits, against the previous implementation. Cases include capped words, unsorted words, empty and reversed intervals, repeated/reordered/overlapping clips, take offsets, transitions, fullscreen holds, absent mappings, and NaN/infinite timestamps. Existing migration, style-preservation, and serialization tests pass. The native GPUI app was not launched locally.


Confidence Score: 5/5
The PR appears safe to merge.Summary
Caption projection now borrows source captions instead of cloning a temporary clamped copy.
No actionable issues were found. Tests were not run during this review.
Reviews (1) · Last reviewed commit: "perf(project): avoid cloning captions be..." · Reviewed by Greptile