Skip to content

perf(project): resolve style groups in one pass - #2957

Merged
richiemcilroy merged 2 commits into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-style-resolution
Oct 23, 2026
Merged

richiemcilroy merged 2 commits into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-style-resolution

Conversation

@OptimistOtaku

@OptimistOtaku OptimistOtaku commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Frame settings resolve background, camera, and cursor styles with three separate scans of the same style segments. Playback and export pay for all three even in gaps where no style is active. With 200 style segments, the committed release benchmark reduces an inactive lookup from 2.169 µs to 0.770 µs (2.82× faster).

Select the winning segment for each group in one pass, then apply only those overrides. Track priority, later start, and later original index still decide each group independently. Numeric comparison preserves tied signed-zero starts. Inactive/invalid segments and non-finite query times remain excluded, and frames without an applicable override still borrow the base configuration. The existing single-group lookup remains available for cursor-only and camera-padding queries.

Benchmark

Windows x86_64, Ryzen 5 5600H, Rust 1.88.0 GNU, repository release profile (opt-level=s, thin LTO). The benchmark compares the previous style_at implementation with the new method in the same binary. Seven alternating paired samples after warmups; medians shown. Each sample uses 10,000 inactive queries or 1,000 active queries. Complete configurations are checked for equivalence before timing, and owned results are dropped within the measurement.

Styles / query Before After Speedup
0 / inactive 0.086 µs 0.078 µs 1.11×
20 / inactive 0.404 µs 0.179 µs 2.25×
200 / inactive 2.169 µs 0.770 µs 2.82×
1,000 / inactive 11.377 µs 3.279 µs 3.47×
20 / active 4.432 µs 3.725 µs 1.19×
200 / active 26.449 µs 25.250 µs 1.05×
1,000 / active 144.583 µs 145.828 µs 0.99×

Active styles still clone the project configuration, so the gain is concentrated in inactive queries; the largest active control was approximately 1% slower. This measures style resolution in the shared frame-settings path, not overall rendering or FPS.

cargo test -p cap-project --locked --release --lib benchmark_style_resolution -- --ignored --nocapture

Validation

  • cargo fmt --all
  • cargo check -p cap-project --locked
  • cargo test -p cap-project --locked --lib: 167 passed, three benchmarks ignored by default; the style benchmark was run separately.
  • cargo clippy -p cap-project --all-targets --locked -- -D warnings
  • git diff --check

The differential test compares resolved configurations and borrowed/owned behavior against the original implementation, including overlapping tracks, independent group winners, tied starts, signed zero, disabled/invalid intervals, exact boundaries, and NaN/infinite query times. Existing style precedence, padding, migration, and serialization tests pass. The native GPUI app was not launched locally.

This branch is based directly on upstream main and is independent of #2956.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge; no actionable issues were found.

Summary

style_at now selects background, camera, and cursor overrides in one scan instead of three.

  • Frame settings find background, camera, and cursor styles in one pass.

Reviews (1) · Last reviewed commit: "perf(project): resolve style groups in o..." · Reviewed by Greptile

Copilot AI balanced review requested due to automatic review settings October 22, 2026 20:54
@vercel

vercel Bot commented Oct 22, 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 reached their quota limit.

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.

@richiemcilroy
richiemcilroy merged commit f9f239e into CapSoftware:main Oct 23, 2026
44 of 46 checks passed
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.

3 participants