Repository navigation
perf(project): resolve hidden cursor windows without allocation - #3437
OptimistOtaku wants to merge 2 commits into
Conversation
|
@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.
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.
|
Thanks for this. The win is tens of nanoseconds per frame against a multi-millisecond frame budget, and several rows in your own table get slower (no-hidden 20/200/1000 clips, 1000 clips with holds), so it isn't worth the extra code in cursor_visibility_at. |
|
Thanks Richie, that's fair. I put too much weight on the relative microbenchmark gains here. Removing the allocation still leaves the full clip traversal and hold mapping, and the regressions in the no-hidden and large hold cases weaken the case further. I agree the absolute savings don't justify the added complexity in this per-frame path. I'll take that into the next contribution: profile a meaningful bottleneck first, then check the absolute savings and common-case controls before proposing the change. |
|
Thanks! Can you rebase on main to clear the conflicts? Then we'll take a look. |
b6eabbf to
1f12a8c
Compare
|
Rebased onto main ( @greptileai please review the rebased head, |
Playback and export call
cursor_visibility_atfor every frame. When a project contains hidden-cursor clips, it constructs and drops a vector of every hidden run just to select the run containing that frame.Merge runs while retaining the first matching window and the total clip duration, using fixed stack storage. The complete traversal remains necessary for fades at the timeline's end. Fullscreen-hold mapping, transition arithmetic, adjacent-run merging, exclusive end boundaries, and fade calculations retain their previous behavior. The small no-hidden-clips entry path is kept separate from the heavier implementation.
Measurements
Windows x86_64, Ryzen 5 5600H, Rust 1.88 GNU, repository release profile (
opt-level=s, thin LTO). Nine alternating paired samples after warmups, each with 10,000 varying frame times. The ignored benchmark compares the exact previous functions with production code and checks complete float-bit equivalence before timing.The benefit is concentrated in hidden-clip projects without large transition/hold workloads. No-hidden controls cost approximately 6–48 ns more in the larger fixtures; the 1,000-clip transition/hold control was about 4% slower. A second complete run retained the hidden-clip gains and that largest control's regression. Hold-window allocation and full clip traversal remain. These measure cursor visibility CPU work, excluding GPU rendering and overall FPS.
cargo test --locked -p cap-project --release --lib benchmark_cursor_visibility -- --ignored --nocaptureValidation
cargo fmt --all,cargo check --locked -p cap-projectcargo test --locked -p cap-project --lib --tests: 286 library tests and four integration tests passed after rebasing; seven benchmarks ignored by default. The cursor benchmark measurements above are from the original PR run.cargo clippy --locked -p cap-project --all-targets -- -D warningsgit diff --checkDifferential tests cover every hidden/visible pattern through six clips, fractional speeds, transitions, overlapping fullscreen holds, exact fade/window boundaries and neighboring representable timestamps, empty timelines, degenerate clips, and non-finite inputs. No dependencies, platform-specific code, persistent caches, or project-format changes. The native GPUI app was not launched locally. This branch is independent of #3436. Rebased onto main
6fbbaa577; the conflict resolution retains main's marker exports alongside the cursor test module. An existing shape-test field assignment was moved into its initializer to pass all-target Clippy without changing test behavior.

Confidence Score: 5/5
The rebased PR appears safe to merge, with no actionable issues found.Summary
Removes the hidden-run vector from
cursor_visibility_atwhile keeping the previous window selection and fade calculations.No actionable issues found. Build and test results were inspected as reported, not rerun.
Reviews (2) · Last reviewed commit: "test(project): initialize non-finite str..." · Reviewed by Greptile