Repository navigation
perf(project): index caption mappings across reordered clips - #3602
Open
OptimistOtaku wants to merge 1 commit into
Open
OptimistOtaku wants to merge 1 commit into
OptimistOtaku wants to merge 1 commit into
Conversation
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. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
This branch has not been deployed
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.
Moving clips out of source order disables the existing ordered-caption lookup and makes projection scan every clip for every caption. In the committed full-derivation benchmark, a 2,000-clip/6,000-caption shuffled timeline drops from 21.23 ms to 6.90 ms (3.08× faster). This path is used by GPUI caption synchronization after timeline edits and by shared editor loading.
Build a temporary source-sorted mapping index with prefix maximum ends, select overlapping candidates by binary search, then restore their original timeline order before generating caption pieces. That keeps split IDs, output ordering, word timing and source-style inheritance intact. Candidate storage is reused across captions. Already ordered timelines retain the direct slice iterator; fewer than 32 clips or 16 captions, invalid source ranges, non-finite caption bounds and broad candidate spans retain the existing scan. No persistent cache, public API, dependency or project-format changes.
Benchmark
Windows x86_64, Ryzen 5 5600H, Rust 1.88 GNU, repository release profile (
opt-level=s, thin LTO). Seven alternating paired samples after two warmups, ten derivations per sample. Complete mapped output and track output are checked against the exact upstream functions before timing. Measurement includes index preparation, projection, override preservation, sorting, allocation and output destruction; excludes I/O, speech recognition and GPUI dispatch.The benefit is concentrated in large reordered timelines. The 60-clip ordered control was about 18% slower in this run; on a second complete run it was neutral, with the other ordered controls 0–4% slower. That rerun retained 1.67–1.69× gains at 500 reordered clips and 3.00–3.08× at 2,000. Absolute timings varied on this workstation. This is a caption derivation benchmark, not an overall editor-FPS multiplier.
cargo test --locked -p cap-project --release --lib benchmark_unordered_caption_projection -- --ignored --nocaptureValidation
cargo fmt --allcargo check --locked -p cap-projectcargo test --locked -p cap-project --lib --tests: 203 library tests and four integration tests passed; five benchmarks ignored by default, new benchmark run separately.cargo clippy --locked -p cap-project --all-targets -- -D warningsgit diff --checkTests compare complete output and float bits across threshold sizes, reversed/shuffled/repeated clips, nested intervals and a long clip overlapping many short clips, shared edges, wordless captions, unsorted/capped/non-finite words, invalid clip ranges, take offsets, speed changes, transitions, overlapping fullscreen holds, split IDs and caption styles. Both baseline functions match upstream
f7d351611exactly. Native GPUI interaction was not exercised locally.This branch is based directly on main, independently of #3601; the two branches combine without textual conflicts.


Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
Speeds up caption projection for large, reordered timelines with a temporary source-sorted index.
Reviewed statically; tests and benchmarks were not run during this review.
Reviews (1) · Last reviewed commit: "perf(project): index caption mappings ac..." · Reviewed by Greptile