Skip to content

[TD] Update api/base64 to use jsg::BufferSource#4908

Merged
jasnell merged 3 commits intomainfrom
jasnell/base64-module-buffersource
Aug 27, 2025
Merged

[TD] Update api/base64 to use jsg::BufferSource#4908
jasnell merged 3 commits intomainfrom
jasnell/base64-module-buffersource

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Aug 26, 2025

Avoid an additional copy when returning results to JS by using a jsg::BufferSource as the output type. Since we are running in the v8 sandbox now, kj::Arraykj::byte allocations that are not backed by a v8::BackingStore are more expensive because they require a copy to get the data into the sandbox.

(TD == Technical Debt)

@jasnell jasnell requested a review from a team August 26, 2025 17:11
@jasnell jasnell requested review from a team as code owners August 26, 2025 17:11
@jasnell jasnell marked this pull request as draft August 26, 2025 17:32
Avoid an additional copy when returning results to JS by
using a jsg::BufferSource as the output type. Since we are
running in the v8 sandbox now, kj::Array<kj::byte> allocations
that are not backed by a v8::BackingStore are more expensive
because they require a copy to get the data into the sandbox.
@jasnell jasnell force-pushed the jasnell/base64-module-buffersource branch from b747d6b to 47f34f2 Compare August 26, 2025 21:06
@jasnell jasnell marked this pull request as ready for review August 26, 2025 21:06
Co-authored-by: Nicholas Paun <npaun@cloudflare.com>
@jasnell jasnell enabled auto-merge (squash) August 27, 2025 17:41
@jasnell jasnell merged commit 826d1b0 into main Aug 27, 2025
21 checks passed
@jasnell jasnell deleted the jasnell/base64-module-buffersource branch August 27, 2025 18:08
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.

2 participants