Skip to content

perf(editor): skip timeline redraws for wheel and pinch events that change nothing - #3757

Open
ManthanNimodiya wants to merge 3 commits into
CapSoftware:mainfrom
ManthanNimodiya:perf/timeline-wheel-noop
Open

ManthanNimodiya wants to merge 3 commits into
CapSoftware:mainfrom
ManthanNimodiya:perf/timeline-wheel-noop

Conversation

@ManthanNimodiya

@ManthanNimodiya ManthanNimodiya commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Trackpad momentum keeps sending wheel events (~120/s) after the timeline transform has hit its clamp, e.g. swiping left on a fully zoomed-out timeline or pinching past the zoom limits. Each of those events still logged an info "timeline transform" line and called cx.notify() on the whole editor, rebuilding every section for a transform that had not changed.

timeline_wheel and timeline_pinch now compare the transform before and after and return early when it is unchanged. The deferred timeline_scroll offset restore still runs, and gpui's scroll container still notifies on its own when its offset moves.

Measurements

New wheel-at-edge scenario in the timeline bench (CAP_GPUI_AUTO_TIMELINE_BENCH=1): fully zoomed out, a horizontal wheel event toward the start before each timed draw. M4 MacBook Pro, 30 s studio project (display, camera, mic, system audio), release build, 3 alternating runs each:

run before (mean draw) after (mean draw) clean (no change, reference)
1 5267 µs 872 µs 924 / 958 µs
2 4158 µs 999 µs 920 / 946 µs
3 4083 µs 1373 µs 958 / 1363 µs

After the change a clamped wheel event costs the same as the clean scenario. The bench forces a draw every iteration, so in the app the saving is larger: no frame is requested at all. The bench log also drops from 360 "timeline transform" lines to 0.

Validation

  • cargo test --locked --bin cap-gpui passes: 1777 passed, 0 failed.
  • cargo fmt --check clean for the changed files.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR skips editor redraws and transform logs when wheel or pinch events leave the timeline unchanged.

  • Timeline wheel and pinch input skips redraws when the transform stays put.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

…hange nothing

Adds a wheel-at-edge scenario to the timeline bench.
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@ManthanNimodiya is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

This comment has been minimized.

Seeks to 0 before zooming out so every wheel event clamps from the first frame.
@ManthanNimodiya

Copy link
Copy Markdown
Contributor Author

@greptileai review

@ManthanNimodiya

Copy link
Copy Markdown
Contributor Author

@richiemcilroy

@vercel

vercel Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

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

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Nov 17, 2026 6:02am UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status November 17, 2026 06:02 Inactive
@ManthanNimodiya

Copy link
Copy Markdown
Contributor Author

@greptileai review

@richiemcilroy merged main in, so this is current. Greptile was 5/5 and CI green on the previous head; cargo test --bin cap-gpui passes on the merged code (1990 tests).

This branch was previously deployed

1 inactive deployment
Preview – cap-status — 82fe2ee1 Deployed Nov 17, 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