Repository navigation
perf(studio): a long project's clips get their durations in one update per source - #6765
Closed
miguel-heygen wants to merge 1 commit into
Closed
miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
…e per source, not one per clip
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 146 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
2 of 4 tasks
Collaborator
Author
|
Superseded by #6773: the redraw per publish was the cost, not the number of publishes; this batching moved no measurement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No measured playback gain; kept only if the per-source batching stands on its own.
What
Opening a long project in Studio now updates the timeline once per media source as its length is read, not once per clip.
Why
A project with hundreds of clips over a few dozen files made the timeline store publish a full copy of its element list for every clip as each file's header was read. Every publish woke the timeline's subscribers (row virtualization, scroll snapshots, cursor anchoring), which read layout each time. A CPU profile of a 600-clip project's first playback listed these costs (media probe completion, row virtualization layout effect, scroll snapshot, cursor anchor DOM queries) and about 13 ms of 49 s in the media fetch stream wrapper, so this is not a streaming problem.
Related work
None open on this path.
How
probeMissingSourceDurationsnow callsapplywith akey -> secondsmap; clips sharing a source resolve in the same microtask run, so one source is one call.useTimelinePlayerpatches every matching element in onesetState, and returns the same state when nothing needs patching, so an already-measured clip publishes nothing (the old{}return still notified).Test plan
fails without the fix:
hands the durations of clips sharing a source over in one callinpackages/studio/src/player/lib/mediaProbe.test.ts; with the single-flush guard removed it fails withexpected "vi.fn()" to be called 1 times, but got 3 times.What I measured
mediaProbe.test.tsandsrc/player/hooks: 216 tests green, three runs; oxfmt and oxlint clean onpackages/studio/src/player.What I did NOT execute
A reproduction of the reported slowdown. My generated 600-clip, 30-source project did not fall to a low ratio even before this change, so this PR is not shown to fix it.
tscforpackages/studio(workspace unbuilt on the test box).Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments"