Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Faster base64FromBytes & bytesFromBase64 on Node.JS #649

Merged
merged 2 commits into from
Aug 6, 2022

Conversation

coyotte508
Copy link
Contributor

@coyotte508 coyotte508 commented Aug 6, 2022

I didn't change the browser code but for .. of would probably be more performant than forEach on it

@stephenh
Copy link
Owner

stephenh commented Aug 6, 2022

@coyotte508 looks great! Looks like there are a few test failures/need the fix / feat prefix for your PR, but otherwise lgtm. Thanks!

@coyotte508 coyotte508 changed the title ⚡️ Improve base64FromBytes & bytesFromBase64 perf on Node.JS perf: Faster base64FromBytes & bytesFromBase64 on Node.JS Aug 6, 2022
@coyotte508
Copy link
Contributor Author

The failing test was caused because expecting a Uint8Array instead of a Buffer (even though Buffer is a subclass of Uint8Array and is type-compatible since node 4.x).

I used Uint8Array.from() to convert the buffer back to an Uint8Array

@stephenh
Copy link
Owner

stephenh commented Aug 6, 2022

Thanks @coyotte508 , I'll hit merge!

@stephenh stephenh merged commit 82ab341 into stephenh:main Aug 6, 2022
stephenh pushed a commit that referenced this pull request Aug 7, 2022
## [1.121.4](v1.121.3...v1.121.4) (2022-08-07)

### Performance Improvements

* Faster base64FromBytes & bytesFromBase64 on Node.JS ([#649](#649)) ([82ab341](82ab341))
@stephenh
Copy link
Owner

stephenh commented Aug 7, 2022

🎉 This PR is included in version 1.121.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants