Repository navigation
perf(project): reuse adjacent transition resolution - #3186
Merged
richiemcilroy merged 2 commits intoOct 25, 2026
Merged
richiemcilroy merged 2 commits into
richiemcilroy merged 2 commits into
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. |
Author
|
Ready to merge? @richiemcilroy |
Author
|
@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.
Timeline mapping resolves each clip's outgoing transition with
effective_transition(index + 1), then repeats that lookup as the next clip's incoming transition. This repeats the binary search and duration validation/clamping on frame lookups used by playback, audio mapping, and rendering.Carry the already resolved outgoing transition into the next iteration. Three production lines change; the no-transition fast path and mapping arithmetic are unchanged. No public API, allocation, persistent cache, or invalidation rule is added.
Release measurements
Baseline
1b614d9c0, Linux x86_64, AMD EPYC 9V74, two-CPU quota, CPU 0 affinity, Rust 1.88.0. Root release profile (opt-level=s, thin LTO, one codegen unit). Five alternating independent processes per version; 25 samples after three warmups, 1,024 publicget_frame_mappingcalls per sample. Medians of process medians:Fixtures use different source offsets, clip lengths, speeds, recording clips and transition types. Queries cover the timeline evenly; output slots are reused. Fixture construction and complete result fingerprinting are outside timing. Every baseline/head fingerprint matches. The 1,000-clip case is a stress test. These are small absolute CPU savings per frame and do not establish an end-to-end playback/export speedup. Full native GPUI/GPU execution was not benchmarked.
An additional package-only optimization-level-3 control (
--config profile.release.package.cap-project.opt-level=3, dependencies otherwise retain the root release profile) also shows 31.8–46.5% reductions across the transition cases. The 100-clip dense case is 1,521.503 → 823.001 ns per mapping; the no-transition control is 21.223 → 21.154 ns. This uses the same five-process/25-sample protocol, and all fingerprints match both the baseline and the size-optimized runs. It measures this function at level 3, without claiming a full GPUI build or whole-app speedup.Correctness and validation
A normal test passes on both the original and optimized implementations. It derives expected mappings from independently computed clip offsets and checks exact source-time bits, segment identities, transition progress, durations and output boundaries. It covers eight consecutive clips with speed changes, adjacent/sparse transitions, half-clip duration clamping, zero/NaN/infinite durations, and ignored first/out-of-range transitions. Start, midpoint and end-adjacent positions are checked; negative time, timeline end, NaN and infinity remain unmapped. Existing hold/transition composition and legacy no-transition tests also pass.
cargo fmt --all --checkcargo check -p cap-project --lockedcargo test -p cap-project --locked: 179 library and 4 integration tests pass; 4 existing benchmarks ignored.cargo clippy -p cap-project --all-targets --locked -- -D warningsgit diff --checkReproduction
Copy the example onto both revisions, build separately, save the binaries, then alternate five runs each:
The example prints per-sample nanoseconds per mapping and complete mapping-result fingerprints. The source example is included so these measurements can be reproduced on the baseline and head.
Per-process medians (nanoseconds per mapping)


Confidence Score: 5/5
The PR appears safe to merge; the reused transition preserves the existing mapping behavior.Summary
Reuses each clip’s resolved outgoing transition as the next clip’s incoming transition.
Reviews (2) · Last reviewed commit: "Merge branch 'main' into perf/reuse-adja..." · Reviewed by Greptile