Skip to content

Use native base64 encoder when available#1477

Open
ajeetdsouza wants to merge 2 commits into
mainfrom
ajeet/base64encode
Open

Use native base64 encoder when available#1477
ajeetdsouza wants to merge 2 commits into
mainfrom
ajeet/base64encode

Conversation

@ajeetdsouza

@ajeetdsouza ajeetdsouza commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Leverages https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64 where possible. Improves performance of binary encoding in JSON.

Task before (ns/op) after (ns/op) Δ
toJson/general 136,347 120,333 −11.7%
toJson/scalar 878.6 818.0 −6.9%
toJson/repeated-message 914,798 855,803 −6.4%
toJson/map-message 1,075,609 1,030,640 −4.2%
toJson/map-scalar 2,364.8 2,379.8 +0.6%
toJson/repeated-scalar 2,494.5 2,510.0 +0.6%
toJson/user-tiny 262.5 264.4 +0.7%
toJson/user-normal 660.8 667.1 +0.9%

This needs a follow up doing the same for fromBase64.

@ajeetdsouza
ajeetdsouza requested a review from timostamm July 24, 2026 01:14
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
protobuf-es Ignored Ignored Preview Jul 24, 2026 10:56am

Request Review

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.

1 participant