Skip to content

perf(project): resolve hidden cursor windows without allocation - #3437

Open
OptimistOtaku wants to merge 1 commit into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-cursor-visibility-windows
Open

OptimistOtaku wants to merge 1 commit into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-cursor-visibility-windows

Conversation

@OptimistOtaku

@OptimistOtaku OptimistOtaku commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Playback and export call cursor_visibility_at for 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.

Clips Hidden clips Transitions Holds Before (ns) After (ns) Speedup
2 None No No 3.33 3.07 1.08×
2 All No No 58.01 17.94 3.23×
2 Mixed No No 69.65 20.46 3.40×
2 Mixed Yes No 75.80 25.36 2.99×
2 Mixed Yes Yes 141.38 94.25 1.50×
20 None No No 9.82 15.37 0.64×
20 All No No 128.95 83.50 1.54×
20 Mixed No No 196.30 88.34 2.22×
20 Mixed Yes No 305.81 203.31 1.50×
20 Mixed Yes Yes 530.48 434.08 1.22×
200 None No No 90.84 108.05 0.84×
200 All No No 892.96 790.40 1.13×
200 Mixed No No 1,176.43 848.08 1.39×
200 Mixed Yes No 3,116.00 2,863.57 1.09×
200 Mixed Yes Yes 5,931.31 5,729.84 1.04×
1,000 None No No 568.59 616.30 0.92×
1,000 All No No 5,378.99 4,777.59 1.13×
1,000 Mixed No No 5,660.08 4,880.92 1.16×
1,000 Mixed Yes No 21,384.78 20,603.92 1.04×
1,000 Mixed Yes Yes 40,407.80 42,132.87 0.96×

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 --nocapture

Validation

  • cargo fmt --all, cargo check --locked -p cap-project
  • cargo test --locked -p cap-project --lib --tests: 196 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 warnings
  • git diff --check

Differential 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.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Replaces the allocated list of hidden-cursor runs with one matching run while preserving the total duration.

  • Hidden-cursor checks find their window without building a list.

Reviews (1) · Last reviewed commit: "perf(project): resolve hidden cursor win..." · Reviewed by Greptile

Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:41
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants