Skip to content

perf(editor): use ordered cursor lookups for raw-mode preview frames - #3407

Open
Aqua-123 wants to merge 1 commit into
CapSoftware:mainfrom
Aqua-123:perf/raw-cursor-preview
Open

Aqua-123 wants to merge 1 commit into
CapSoftware:mainfrom
Aqua-123:perf/raw-cursor-preview

Conversation

@Aqua-123

@Aqua-123 Aqua-123 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

With raw cursor mode on, PreviewCursorCache returns no timeline, so paused and scrubbed preview frames use ProjectUniforms::new. That passes the default event order, so each cursor lookup is a linear scan of all moves and clicks. #2489 fixed this for playback and export, and named paused preview of raw projects as out of scope.

What changed

  • CursorEventOrder is public. CursorEventOrder::new holds the ordering check that PrecomputedCursorTimeline::new did before.
  • New ProjectUniforms::new_with_cursor_event_order. new calls it with the default order, so its other callers are unchanged.
  • PreviewCursorCache::event_order computes the order once for each cursor events allocation. It keys on a Weak pointer, so it copies and keeps no events. The editor and preparing-preview fallbacks use it.

Scope

  • Removing the raw_cursor: cursor.clone() copy in PrecomputedCursorTimeline::new is left for a follow-up. It costs about 4.7 ms once per segment at 60 min and touches about 25 call sites.

Verification

  • 60 min recording, paused frame near the end: 388 µs → 0.6 µs per uniform build, p50 (benchmark_raw_cursor_preview_uniforms, ignored test). The one-time order check costs about 150 µs.
  • New test raw_cursor_event_order_preserves_preview_uniforms_and_pixels compares the uniforms and rendered pixels of both paths on ordered, shuffled, equal-timestamp and click-only data.
  • preview_cursor_cache_bypasses_raw_mode_without_retaining_cursor_data still checks that the cache keeps no events.

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

This PR lets raw-mode preview frames reuse ordered cursor lookups instead of scanning all events.

  • Raw-cursor previews reuse event order to find cursor moves faster.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "perf(editor): use ordered cursor lookups..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@Aqua-123 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant