Repository navigation
perf(project): index edited-time caption migration lookups - #3601
Open
OptimistOtaku wants to merge 2 commits into
Open
OptimistOtaku wants to merge 2 commits into
OptimistOtaku wants to merge 2 commits 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.
Opening an older captioned project converts every edited-time caption and word timestamp back to source time. Each timestamp currently scans the clip mappings backwards, so heavily edited recordings pay for a clip scan per word. In the committed complete-synchronization benchmark, a 2,000-clip/20,000-word project drops from 130.42 ms to 30.24 ms (4.31× faster).
For at least 128 clips, validate that edited starts and ends are finite and monotonic, then binary-search the last mapping whose start is at or before the timestamp. Shared boundaries retain the previous reverse scan's last-match priority. Small timelines and invalid/non-monotonic mappings retain the original lookup. Rounded final timestamps and fullscreen-hold conversion are unchanged.
This runs through GPUI caption synchronization and the shared editor-loading path. It only accelerates the legacy
source_timed = falseconversion; already source-timed captions retain their path. No persistent cache, public API, dependencies, 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; five fresh projects per sample. Inputs are cloned outside timing and complete output projects are compared before measurement. Timings include the fullsynchronize_captionscall: migration, caption projection, sorting and output construction. File I/O, model inference, GPUI launch, and output destruction are excluded.The single-clip control was approximately 3% slower. A second complete run measured 1.89× and 4.51× gains at 500 and 2,000 clips, with a roughly 6% slower single-clip control and a neutral 60-clip control. The gain is for older projects with many clip mappings; this is not an overall editor-startup multiplier.
cargo test --locked -p cap-project --release --lib benchmark_caption_migration_lookup -- --ignored --nocaptureValidation
cargo fmt --allcargo check --locked -p cap-projectcargo test --locked -p cap-project --lib --tests: 204 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 --checkThe reference synchronization function matches upstream
f7d351611exactly. Tests compare whole migrated projects and repeated synchronization, including styles, reordered clips, transitions, overlapping holds, shared/zero-length boundaries, gaps, neighboring float values, non-finite timestamps and invalid timescales. Existing rounded-timeline-end migration tests pass. Native GPUI startup was not exercised locally.

Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
Speeds up legacy caption migration by replacing repeated reverse scans with binary searches on timelines with at least 128 ordered clip mappings.
Reviews (1) · Last reviewed commit: "perf(project): retain linear migration f..." · Reviewed by Greptile