-
Notifications
You must be signed in to change notification settings - Fork 760
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
base64 encode/decode is really slow #1187
Comments
FYI, here's a node script that I used.
result:
|
@yasushi-saito Thanks a lot for discovering the performance bottleneck and doing the benchmark! :) Although, it's unlikely that we'll adopt a third-party library (i.e. Maybe you could also consider filing this bug to the closure library, which we (and other dependencies) would benefit from if they can make a performance improvement? Thanks! :) |
Makes sense. I created an issue google/closure-library#1161 |
Thanks for filing the bug! I've subscribed also :) |
Background: we have a grpc-web-based app that performs bulk data upload, and it can sustain only about ~15MB/s regardless of the underlying network speed. The reason is that the base64 encoder used by grpc-web (goog.crypt.base64) is quite slow. I did a quick benchmark between
goog.crypt.base64.encodeByteArray
vsBase64.fromUint8Array
(fromhttps://www.npmjs.com/package/js-base64
), and the former is about 50x slower than js-base64. E.g., encoding a random 16MB Uint8Array payload takes about ~1000ms withgoog.crypt.base64
, 19ms withjs-base64
.The text was updated successfully, but these errors were encountered: