Skip to content

perf(editor): skip timeline rebuild for model-irrelevant slider edits - #3264

Merged
richiemcilroy merged 1 commit into
CapSoftware:mainfrom
PravinMandal:perf/slider-timeline-rebuild
Oct 25, 2026
Merged

richiemcilroy merged 1 commit into
CapSoftware:mainfrom
PravinMandal:perf/slider-timeline-rebuild

Conversation

@PravinMandal

@PravinMandal PravinMandal commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Classify every variant of the seven sidebar slider enums explicitly, then route the edits that cannot change the timeline through project_changed_without_timeline.

Covered sliders:

  • background (BgSlider)
  • camera (CameraSlider)
  • cursor (CursorSlider)
  • caption (CaptionSlider)
  • keyboard (KeyboardSlider)
  • color grade (GradeSlider)
  • animated-gradient parameters, stops, add/remove, drag-insert, and fine-tune reset

Audio levels, clip volume, segment fields, and panel sliders keep the full rebuild.

Why

A slider drag on a large project rebuilt TimelineModel and TrackLanes even when the edited field was never read by either. On a 2,000-clip stress fixture the skipped rebuild costs 171–175 µs release and 0.51–0.59 ms debug per edit. The rest of project_changed — history, publish, save, notify — is unchanged and still runs.

Benchmark

cargo test --release --manifest-path apps/desktop-gpui/Cargo.toml --bin cap-gpui -- \
  --ignored benchmark_slider_edit_skips_timeline_rebuild --nocapture
Build Median per skipped TimelineModel::build_with_lanes
release 171.262 µs (rerun on the rebased head; 175.189 µs before the rebase)
debug 0.51–0.59 ms (two runs)

The fixture is 2,000 synthetic contiguous clips plus every track kind. It is a stress case, not a typical project. The benchmark measures only the skipped rebuild; history, publish, save, and notify are not included. Host load was ~6 during the runs.

Correctness

  • Every variant of the seven enums has an exhaustive classification; a table test pins each boolean so flipping an existing variant fails.
  • Negative controls cover audio levels, caption/keyboard enable flags, and camera visibility.
  • The invariance test rebuilds TrackLanes::from_project from the mutated project and compares the full debug model before/after.
  • Animated-gradient controls are safe because TimelineModel::build and TrackLanes::from_project do not read the background.
  • Undo/redo still rebuild; the skipped path still records history, publishes the project, schedules a save, and notifies.

Tests

cargo test -p cap-desktop-gpui slider_ -- --nocapture
cargo test -p cap-desktop-gpui audio_levels_still_change_the_timeline_model -- --nocapture
cargo test --release -p cap-desktop-gpui benchmark_slider_edit_skips_timeline_rebuild -- --ignored --nocapture

All pass on 7c4395e5d after rebase (a3817dd4). git diff --check is clean.
The rebase picked up the manual-caption position sliders from #3230; ManualX
and ManualY are classified no-rebuild and pinned in the same table test.

Scope / caveats

  • One commit, five files, all in apps/desktop-gpui.
  • Only routing for the seven edited slider enums changes; unrelated panel and clip-volume edits are left for separate PRs.
  • Numbers are from this host and the synthetic stress fixture; they are not a claim about typical project latency.

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Skips timeline rebuilds for explicitly classified styling sliders and animated-gradient edits.

  • Sidebar styling edits skip rebuilding the timeline model.

Reviews (2) · Last reviewed commit: "perf(editor): skip timeline rebuild for ..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@PravinMandal
PravinMandal force-pushed the perf/slider-timeline-rebuild branch from 7fd5e5a to e758eff Compare October 25, 2026 17:39
The background, camera, cursor, caption, keyboard, color-grade and
animated-gradient sliders only write fields TimelineModel::build and
TrackLanes::from_project do not read, yet every drag rebuilt both. Classify
every variant of those seven enums explicitly and route safe edits through
project_changed_without_timeline. Audio levels and segment fields keep the
full rebuild; animated-gradient add/remove/stop/reset edits share the safe
route.

Benchmark: 2,000 synthetic clips with every track kind (a stress fixture, not
a typical project), release 175.189 us and debug 0.51-0.59 ms per skipped
TimelineModel::build_with_lanes (median of 10 samples, 10 iterations each,
warmup 3; host load ~6). The rest of project_changed (history, publish, save,
notify) is unchanged and not measured.
@PravinMandal
PravinMandal force-pushed the perf/slider-timeline-rebuild branch from e758eff to a3817dd Compare October 25, 2026 18:47
@PravinMandal

Copy link
Copy Markdown
Contributor Author

@greptileai review

@richiemcilroy
richiemcilroy merged commit ca1ff1a into CapSoftware:main Oct 25, 2026
42 of 44 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.

2 participants