Skip to content

perf(desktop-gpui): store the frame time on a paused seek so its echo does not rebuild the editor again - #2869

Open
richiemcilroy wants to merge 1 commit into
mainfrom
perf/gpui-scrub-single-rebuild
Open

richiemcilroy wants to merge 1 commit into
mainfrom
perf/gpui-scrub-single-rebuild

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Why

Every pointer move while dragging the playhead with playback paused rebuilt the whole editor (header, toolbar, sidebar, transport, timeline) twice. seek_to_time notifies the editor once, then the engine echoes the seek back through playhead_changed(frame). seek_to_time had stored the unrounded pointer time while the echo carries frame / 60, so the echo's "already there" check never matched and invalidate_playback_chrome notified the whole editor a second time, a frame later.

What

A paused seek now stores frame / EDITOR_PREVIEW_FPS, the exact value its echo carries, so the echo returns early. Playing seeks are unchanged (the echo there only touches the timeline and transport). playhead_changed and the seek share the same frame_seconds helper so the two values are bit-identical.

The settled playhead is the same as before: it already became frame / 60 once the echo landed. The only difference is that the line is drawn on the frame grid immediately instead of one draw later.

Measured

Scratch A/B on a Blacksmith macOS 26 runner, the GPUI editor driven through the real ruler scrub handlers (timeline_hover then timeline_mouse_move) every 16 ms for 10 s, 3 rounds, 40 s 1080p30 studio fixture.

per scrub step base head
full editor rebuilds (header, sidebar, toolbar renders), forward 1.99 / 2.00 / 1.99 1.00 / 1.00 / 1.00
full editor rebuilds, backward 1.99 / 1.99 / 1.99 1.00 / 1.00 / 1.00
main thread CPU, forward scrub 35.5% / 40.7% / 41.1% 24.8% / 24.0% / 23.8%
main thread CPU, backward scrub 40.3% / 42.7% / 34.1% 13.3% / 24.4% / 19.8%
seek to frame on screen p95, forward 7.9 / 8.5 / 9.5 ms 4.8 / 4.8 / 5.3 ms

Frames presented per seek are unchanged (1.00 forward on both). Playback and hover counters are unchanged: no section other than the timeline and transport re-renders during playback on either side.

Tests

paused_seek_lands_where_its_echo_does checks, for every frame of an hour at 60 fps, that the paused seek stores exactly the time playhead_changed computes for the echo (so its early return fires), and that a playing seek keeps the pointer time.

Risk

Low. Every section still rebuilds once per paused seek, so nothing that reads the playhead can go stale.

RetriggerView in GreptileConfidence Score: 5/5

The change appears safe to merge.

Summary

Paused seeks now store the requested frame’s time immediately, so the matching engine echo does not trigger another editor rebuild.

  • Paused playhead seeks now avoid a second full-editor rebuild.

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

Reviews (1) · Last reviewed commit: "perf(desktop-gpui): store the frame time..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cap-status Ready Ready Preview Oct 22, 2026 12:29am UTC

@blacksmith-sh

blacksmith-sh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
cap-verify::crash/crash_safety View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@capy-ai capy-ai Bot 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

This branch was successfully deployed

2 active deployments
Preview – cap-web — 235eff78 Deployed Oct 22, 2026 by vercel[bot]
Preview – cap-status — 235eff78 Deployed Oct 22, 2026 by vercel[bot]
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