Skip to content

perf(core): Safari keeps a later clip's src off until it is near - #7446

Closed
miguel-heygen wants to merge 4 commits into
mainfrom
perf/safari-defer-clip-src
Closed

miguel-heygen wants to merge 4 commits into
mainfrom
perf/safari-defer-clip-src

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

Experiment, parked as a draft: on Safari in the player, a later clip has no src until it is near, so it does not load at page load.

Why

Measured on a phone, every media element loads at page load and reads about 35 MB from the head of the file; a film of many cuts from one 68 MB file moves 575 MB. This tries keeping about two clips live. It is built so the phone can judge it; it is not asked for review.

Related work

Refs the Safari parity work; the in-point fragment attempt is #7436. Neither has beaten main on a phone.

How

holdBackUntilNear removes the src of a later timed clip as it parses (and of those already parsed), restoreHeldBackSrc puts it back when the clip is preloaded, visible, or scheduled for audio. Every reader of the src goes through unproxiedSrc, which answers the authored src while it is held back. Player frame only, WebKit only.

Test plan

  • Unit tests added/updated: preloadMedia.test.ts (held back, restored on preload, restored for the audio route without loading, already parsed, first take and clips without authored length untouched, Studio and other browsers untouched).
  • Manual testing performed: macOS WebKit rig, 8 MB/s, 68 MB film: stand-still 11 to 16 s (main 5 to 19 s); real iPhone run pending.
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments"

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 83 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Closing: deferred src gave no gain on a real iPhone (interleaved with main: 14.7/35.0/28.5 s and 32.6/8.0/30.8 s against main 28.7 s, with main itself sometimes in a 5 s mode). The fragment with fetch-ahead (#7436) is what earned the gain.

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