Skip to content

Multiple improvements to blob implementation#6466

Merged
jasnell merged 2 commits intomainfrom
jasnell/blob-improvements
Apr 2, 2026
Merged

Multiple improvements to blob implementation#6466
jasnell merged 2 commits intomainfrom
jasnell/blob-improvements

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Mar 31, 2026

  • Better handling of recursive slices
  • Better handling of empty blobs
  • Performance optimizations for single-Blob inputs
  • Move away from using BufferSource in blob
  • Avoid extraneous allocation/copy in text()
  • Add compat flag to error when creating a Blob from a resizable ArrayBuffer

@jasnell jasnell requested review from guybedford and npaun March 31, 2026 16:13
@jasnell jasnell requested review from a team as code owners March 31, 2026 16:13
ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

This comment was marked as resolved.

@jasnell jasnell force-pushed the jasnell/blob-improvements branch from 8b87a5b to eb31d8d Compare March 31, 2026 16:25
@codspeed-hq

This comment was marked as outdated.

@jasnell jasnell force-pushed the jasnell/blob-improvements branch from eb31d8d to 95b7e15 Compare March 31, 2026 17:49
@codecov-commenter

This comment was marked as outdated.

@jasnell jasnell force-pushed the jasnell/blob-improvements branch 2 times, most recently from bbd7dab to 7c1e106 Compare March 31, 2026 21:42
Copy link
Copy Markdown
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this is the behaviour in V8, but I don't see that behaviour actually specified?

Is there somewhere to find this discussion / or a WPT that covers this case? Would be much more reassuring to see that.

@jasnell
Copy link
Copy Markdown
Collaborator Author

jasnell commented Apr 1, 2026

It's more the absence of mention in the spec. Blob does not have the AllowResizable webidl attribute.

Browser implementations (chrome, firefox) throw appropriately. Node.js, Deno, and Bun do not... but they should. There does not appear to be any WPT's... but I think in this case it's just safer to follow the behavior of the browsers.

@guybedford
Copy link
Copy Markdown
Contributor

Why would AllowResizable be a problem for Blob to support? Why would we not want to support this use case from a spec perspective? What I'm trying to understand is if this is the right design, or just something that hasn't been properly considered.

@guybedford
Copy link
Copy Markdown
Contributor

Would be good to figure out where the standards discussion should go on this though. Maybe just posting a WPT is a good next step.

jasnell added 2 commits April 1, 2026 12:12
* Better handling of recursive slices
* Better handling of empty blobs
* Performance optimizations for single-Blob inputs
* Move away from using BufferSource in blob
@jasnell jasnell force-pushed the jasnell/blob-improvements branch from 7c1e106 to 50417a4 Compare April 1, 2026 19:14
@jasnell jasnell merged commit 9246dd6 into main Apr 2, 2026
22 of 23 checks passed
@jasnell jasnell deleted the jasnell/blob-improvements branch April 2, 2026 00:24
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.

3 participants