Closed Bug 1811440 Opened 1 year ago Closed 11 months ago

Fix BodyStream to support actual Bring-Your-Own-Buffer(BYOB)

Categories

(Core :: DOM: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
116 Branch
Tracking Status
relnote-firefox --- 116+
firefox116 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files)

Currently BodyStream just enqueues things by creating a new Uint8Array: https://searchfox.org/mozilla-central/rev/7426a35738cd542b9488c7b67f4f6d21edfeda0a/dom/base/BodyStream.cpp#435

Instead, it should write into [[byobRequest]] view when available to reduce copy. The behavior won't be web-visible, it's more for better performance by skipping copy into a new Uint8Array and then again into byob buffer.

Blocks: fetch
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Assignee: nobody → krosylight
Attachment #9319013 - Attachment description: WIP: Bug 1811440 - Write into byob request view if exists when reading BodyStream → Bug 1811440 - Write into byob request view if exists when reading BodyStream r=evilpie,mgaudet

(Preparing release note request early)

Release Note Request (optional, but appreciated)
[Why is this notable]: It provides more performant way when reading stream from Fetch and WebTransport
[Affects Firefox for Android]: Yes
[Suggested wording]: This release now supports proper BYOB readers on Fetch and WebTransport, which allows devs to prepare their ArrayBuffer so that it can be reused for read requests and thus saves memory allocation. .getReader({ mode: "byob" }) on Fetch and WebTransport streams was supported on previous releases but without true BYOB support as new memory allocation still occurred internally.
[Links (documentation, blog post, etc)]: (None)

relnote-firefox: --- → ?
Depends on: 1811882
Attachment #9319013 - Attachment description: Bug 1811440 - Write into byob request view if exists when reading BodyStream r=evilpie,mgaudet → WIP: Bug 1811440 - Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=evilpie,mgaudet
Attachment #9319013 - Attachment description: WIP: Bug 1811440 - Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=evilpie,mgaudet → Bug 1811440 - Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=smaug

... instead of handling it within itself, which makes the error handling story complex.

Attachment #9319013 - Attachment description: Bug 1811440 - Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=smaug → Bug 1811440 - Part 2: Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=smaug
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d61e3f16a3fa
Part 1: Rethrow error from InputToReadableStreamAlgorithms::WriteIntoReadRequestBuffer r=smaug
https://hg.mozilla.org/integration/autoland/rev/d3f82b964829
Part 2: Implement pull-from-bytes algorithm for InputToReadableStreamAlgorithms r=smaug
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: