-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for longs: BigInt
in toObject
#1908
base: master
Are you sure you want to change the base?
Conversation
cli/package-lock.json
Outdated
@@ -36,7 +36,7 @@ | |||
}, | |||
"..": { | |||
"name": "protobufjs", | |||
"version": "7.1.2", | |||
"version": "7.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change appeared when I ran npm run build
. Seems harmless and correct(?)
too soon! |
Hi @alexander-fenster, any chance you would be able to take a look and provide some feedback on this? Thank you 🙏 |
9e56e60
to
8f7ec32
Compare
FYI I've published this fork on npm as |
Still very interested in seeing this get merged |
I've published a new version 0.0.1-toobject-bigint.2 based on v7.3.0. |
@alexander-fenster @mkruskal-google Sorry for direct ping, I'm sure you are busy, but is there any chance yall would be able to provide some guidance/insight on when you might expect to have time to review PRs like this one (and many others in the backlog)? Thanks 🙂 |
Adds support for
toObject({ longs: BigInt })
, which converts longs to native BigInts.This is structured as opt-in so that hopefully it can be shipped in a minor update without having to wait for a 8.x release.
I tested performance of conversion using both
DataView.getBig(U)Int64
and plain bitwise arithmetic: https://jsbench.me/1lljqc4kd7/2 The DataView version was faster, but since getBig(U)Int64 is a relatively more recent addition, I provided a fallback for environments that don't support it.See also:
Motivation:
Currently we are maintaining a patch for protobufjs in foxglove/studio. In order to publish some of these packages to NPM, we replace the patch with something that can actually be shipped in
dependencies
.