Repository navigation
[LiveComponent] Split a download response without copying it - #4272
Merged
smnandre merged 1 commit intoNov 24, 2026
Merged
Conversation
Contributor
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
|||||||||
Kocal
force-pushed
the
perf/live-component-download-split-views
branch
3 times, most recently
from
November 16, 2026 22:28
a784e30 to
d7657da
Compare
| Q | A | -------------- | --- | Bug fix? | no | New feature? | no | Deprecations? | no | Documentation? | no | Issues | | License | MIT For a response with a file download, `BackendResponse` split the body with two `ArrayBuffer.slice()` calls, which copy the HTML part and the file part, before the `TextDecoder` and the `Blob` copy them again. Now both parts are `Uint8Array` views on the same buffer. An invalid or out-of-range `X-Live-Html-Length` gives the same split as `slice()` did (new tests). With a 20 MB file in Chromium: 19.8 ms -> 12.0 ms, and 20 MB less memory allocated during the split.
Kocal
force-pushed
the
perf/live-component-download-split-views
branch
from
November 16, 2026 22:42
d7657da to
b28a180
Compare
Member
|
Thanks @Kocal. |
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.
For a response with a file download,
BackendResponsesplit the body with twoArrayBuffer.slice()calls, which copy the HTML part and the file part, before theTextDecoderand theBlobcopy them again.Now both parts are
Uint8Arrayviews on the same buffer. An invalid or out-of-rangeX-Live-Html-Lengthgives the same split asslice()did (new tests).With a 20 MB file in Chromium: 19.8 ms -> 12.0 ms, and 20 MB less memory allocated during the split.