Repository navigation
perf(studio): a long film's media durations write the store once per file, not once per clip - #6745
Open
miguel-heygen wants to merge 1 commit into
Open
miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
… while their durations load
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 126 of thoseThe gate passes. Quarantined, measured but not gated (0) |
This branch has not been deployed
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.
Description
When a timeline loads, Studio probes the duration of every media file its clips play and writes each result into the player store. It wrote once per clip: a film that cuts one voice-over file into twenty clips wrote the store twenty times when that file's probe came back, each write a new
elementsarray, and every subscriber (the timeline, and the Desktop app's Script panel on top) recomputed each time.Each timeline sync re-probes every clip still missing a duration, so on a long film (600 clips over 30 files) the store was written about 3,600 times while the durations loaded.
probeMissingSourceDurationsnow groups the clips by file, probes each file once (as before), and hands back all of that file's clips in oneapply.useTimelinePlayerwrites them in one store update. That makes one write per file instead of one per clip, with no scheduling or delay added.What I measured
fails without the fix:
hands back every clip of one file in a single apply, so the store is written once per fileinpackages/studio/src/player/lib/mediaProbe.test.ts. With the per-clip version put back, it and the existing same-origin probe test fail.mediaProbe.test.ts: 8 passed, 3 runs in a row.src/player/hooks/: 202 passed. Studiotsc --noEmit: clean.What I did NOT exercise