Repository navigation
perf(producer): download a remote video once per render - #6637
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 118 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (3)
|
Contributor
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 68e98d1e
Probe and localisation now call downloadToTemp with the same url\0destDir key, so localisation is a cache hit. They run in sequence, so there's no in-flight race. Every compileHtmlFile/localize* call gets the same downloadDir, and resolvedPath from the probe is not read. Checked locally: the new test fails on main's htmlCompiler.ts (expected 2 to be 1) and passes here. htmlCompiler.test.ts passes 170/170. CI is green at this head.
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.
What
A render now downloads each remote video or audio file once instead of twice. Compile gets faster by one download of every remote clip.
Why
Compile fetched each remote media URL two times:
resolveMediaDuration) downloaded it into the render's download folder._remote_media/under that folder, so the composition can point at a local copy.downloadToTempreuses a finished download only when both the URL and the destination folder match, so the second request never hit the first file.Why under 100 lines
One lever: the duration probe downloads into the folder localisation already uses, so the existing download cache serves the second request. The rest is the test.
Related work
Refs #5945.
How
resolveMediaDurationdownloads remote media intojoin(downloadDir, REMOTE_MEDIA_SUBDIR), the folder localisation uses. Nothing else changes: the probe still reads the same file, localisation still rewrites the same relative paths.Test plan
htmlCompiler.remoteDownloadOnce.test.tscompiles a composition with one remote video and checks that every download request for it names the same folder (the download cache's key).htmlCompiler.remoteDownloadOnce.test.ts > asks for a remote video in one folder for both its duration probe and its localisation(expected 2 to be 1with only the test applied).tsc --noEmit(producer) exit 0;htmlCompiler.test.ts170 passed,htmlCompiler.probeCount.test.ts1 passed; comment ratchet passes; oxfmt and oxlint clean.Before / after
Published
hyperframes@0.8.210vs the same bundle with only this change. Apple M4 Pro (14 cores, 24 GB),hyperframes renderon repo fixtures with one remote video, interleaved, 5 runs each, medians. Peak RSS is the whole process tree.style-11-prod, 1080x1920, 14 soverlay-montage-prod+ one mix-blend layer, 42 sEvery stage after compile is unchanged (wall minus compile: 10.33 -> 10.11 s and 24.56 -> 24.32 s). The saving scales with the size of the remote media and the network.