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

Uint64: BigInt polyfill #164

Open
tshemsedinov opened this issue Aug 10, 2018 · 5 comments
Open

Uint64: BigInt polyfill #164

tshemsedinov opened this issue Aug 10, 2018 · 5 comments

Comments

@tshemsedinov
Copy link
Member

one of the following solutions

  • took implementation from node.js
  • find third-party polyfill
  • implement polyfill
@tshemsedinov
Copy link
Member Author

See #161 (comment)

@tshemsedinov
Copy link
Member Author

@belochub this is important issue for all other modules. We can use Uint32Array(2) inside, no need to implement literal (and I see no way to do that without compiler) and math operations. All we need is a set of functions with bit/binary operations: and, or, not, xor, shift right and left.

@aqrln
Copy link
Member

aqrln commented Aug 20, 2018

@tshemsedinov interestingly, that might be what we'd want to use for IDs even if BigInt is supported. As far as I can see from https://v8project.blogspot.com/2018/05/bigint.html, V8's implementation of BigInt is optimized for math operations, at the expense of extra conversions to and from two's complement representation when bitwise operations are involved. There's probably no overhead for non-negative numbers as no conversion in needed in this case, but benchmarking that to be sure won't harm anyway though.

@tshemsedinov
Copy link
Member Author

@aqrln I think we will use unsigned Uint32Array(2) for emulation but if BigInt will give less performance we can consider BigUint64Array(1). @bugagashenkj and @lundibundi can prepare comparison.

@aqrln
Copy link
Member

aqrln commented Aug 20, 2018

@tshemsedinov using BigUint64Array won't save us anything because its members, when indexed, are BigInts anyway.

belochub added a commit that referenced this issue Aug 29, 2018
belochub added a commit that referenced this issue Aug 31, 2018
@tshemsedinov tshemsedinov changed the title BigInt polyfill Uint64: BigInt polyfill Aug 31, 2018
belochub added a commit that referenced this issue Sep 5, 2018
belochub added a commit that referenced this issue Sep 8, 2018
belochub added a commit that referenced this issue Sep 11, 2018
Refs: #164
PR-URL: #177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants