Skip to content

perf(Mp4Generator): assemble segment data in a single allocation#10101

Merged
avelad merged 1 commit into
shaka-project:mainfrom
vanyaxk:perf/mp4-generator-segment-data-single-allocation
May 18, 2026
Merged

perf(Mp4Generator): assemble segment data in a single allocation#10101
avelad merged 1 commit into
shaka-project:mainfrom
vanyaxk:perf/mp4-generator-segment-data-single-allocation

Conversation

@vanyaxk

@vanyaxk vanyaxk commented May 18, 2026

Copy link
Copy Markdown
Contributor

This PR reduces allocation pressure in MP4 segment generation by writing mdat data directly into the final segment buffer - this avoids one full media-payload copy per segment

Comment thread lib/util/mp4_generator.js Outdated
Comment thread lib/util/mp4_generator.js Outdated
@avelad avelad added type: performance A performance issue priority: P1 Big impact or workaround impractical; resolve before feature release labels May 18, 2026
@avelad avelad added this to the v5.2 milestone May 18, 2026
@vanyaxk
vanyaxk force-pushed the perf/mp4-generator-segment-data-single-allocation branch from 0da45dc to e9ea7e2 Compare May 18, 2026 08:20
@shaka-bot

Copy link
Copy Markdown
Collaborator

Bundle Size Report for PR #10101

File HEAD Base Diff
controls.css 24.0 KiB (5.0 KiB) 24.0 KiB (5.0 KiB) +0.0 KiB
demo.compiled.debug.js 258.3 KiB (51.8 KiB) 258.3 KiB (51.8 KiB) 0.0 KiB
demo.compiled.js 258.3 KiB (51.8 KiB) 258.3 KiB (51.8 KiB) 0.0 KiB
demo.css 170.4 KiB (27.8 KiB) 170.2 KiB (27.8 KiB) +0.1 KiB
locales.js 43.6 KiB (10.8 KiB) 43.6 KiB (10.8 KiB) 0.0 KiB
receiver.compiled.debug.js 148.8 KiB (24.1 KiB) 148.8 KiB (24.1 KiB) 0.0 KiB
receiver.compiled.js 148.8 KiB (24.1 KiB) 148.8 KiB (24.1 KiB) 0.0 KiB
shaka-player.compiled-es2021.debug.js 1258.7 KiB (309.6 KiB) 1258.4 KiB (309.5 KiB) +0.3 KiB
shaka-player.compiled-es2021.js 666.6 KiB (222.4 KiB) 666.4 KiB (222.3 KiB) +0.2 KiB
shaka-player.compiled.debug.js 1530.8 KiB (350.8 KiB) 1530.5 KiB (350.7 KiB) +0.3 KiB
shaka-player.compiled.js 770.7 KiB (250.1 KiB) 770.4 KiB (250.0 KiB) +0.3 KiB
shaka-player.dash-es2021.debug.js 926.1 KiB (232.8 KiB) 925.7 KiB (232.6 KiB) +0.4 KiB
shaka-player.dash-es2021.js 460.0 KiB (157.0 KiB) 459.9 KiB (157.0 KiB) +0.1 KiB
shaka-player.dash.debug.js 1124.1 KiB (263.0 KiB) 1123.6 KiB (262.7 KiB) +0.5 KiB
shaka-player.dash.js 534.2 KiB (177.0 KiB) 534.1 KiB (177.0 KiB) +0.1 KiB
shaka-player.experimental-es2021.debug.js 1649.8 KiB (394.2 KiB) 1649.5 KiB (394.1 KiB) +0.3 KiB
shaka-player.experimental-es2021.js 919.6 KiB (291.5 KiB) 919.4 KiB (291.4 KiB) +0.2 KiB
shaka-player.experimental.debug.js 1986.2 KiB (444.4 KiB) 1985.9 KiB (444.3 KiB) +0.3 KiB
shaka-player.experimental.js 1045.7 KiB (325.0 KiB) 1045.4 KiB (324.9 KiB) +0.3 KiB
shaka-player.hls-es2021.debug.js 956.3 KiB (238.2 KiB) 956.1 KiB (238.1 KiB) +0.3 KiB
shaka-player.hls-es2021.js 493.1 KiB (167.1 KiB) 492.9 KiB (167.1 KiB) +0.2 KiB
shaka-player.hls.debug.js 1159.5 KiB (269.1 KiB) 1159.2 KiB (268.9 KiB) +0.3 KiB
shaka-player.hls.js 570.2 KiB (188.1 KiB) 569.9 KiB (188.0 KiB) +0.3 KiB
shaka-player.ui-es2021.debug.js 1567.3 KiB (376.8 KiB) 1567.0 KiB (376.7 KiB) +0.3 KiB
shaka-player.ui-es2021.js 879.1 KiB (280.0 KiB) 878.9 KiB (279.9 KiB) +0.2 KiB
shaka-player.ui.debug.js 1873.7 KiB (423.1 KiB) 1873.4 KiB (423.0 KiB) +0.3 KiB
shaka-player.ui.js 993.7 KiB (310.7 KiB) 993.4 KiB (310.7 KiB) +0.3 KiB

@shaka-bot

Copy link
Copy Markdown
Collaborator

Incremental code coverage: 100.00%

@avelad
avelad merged commit 5492f31 into shaka-project:main May 18, 2026
32 of 34 checks passed
avelad pushed a commit that referenced this pull request May 18, 2026
)

This PR reduces allocation pressure in MP4 segment generation by writing
mdat data directly into the final segment buffer - this avoids one full
media-payload copy per segment
avelad pushed a commit that referenced this pull request May 18, 2026
)

This PR reduces allocation pressure in MP4 segment generation by writing
mdat data directly into the final segment buffer - this avoids one full
media-payload copy per segment
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Jul 17, 2026
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: performance A performance issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants