-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Keep long bigint literals in hexadecimal format #4165
Comments
Actually, in the advanced more, both If |
This is a fair optimization request. We may not be able to prioritize this but we'd be happy to receive a PR of this change. |
Could you point me to the file where literals are emitted? |
I think you'd modify the code approximately here.
|
@brad4d Thank you. Where would the tests for this go? |
(Responding since Bradford is out) |
(Correction to my previous comment - I should have said https://github.com/google/closure-compiler/blob/master/test/com/google/javascript/jscomp/CodePrinterTest.java, sorry) |
Thank you. Added some tests. Let me know if there other testing surfaces |
Long bigint literals written in hexadecimal format (such as
0x123456789ABDEFn
) should be kept as is. Currently GCC expands them to decimal bigint literals, which increases the compiled size significantly (up to ~20%).Example:
is transformed to
Many crypto libraries (hashing, verifiable computation, etc) include long list of large constants. Keeping such constants in hexadecimal form makes a big difference.
Writing the literals as
BigInt("0xabc")
is a workaround but is not ideal due to increased compiled size and runtime cost.This incurs up to 20% blow up in compiled code size.
The text was updated successfully, but these errors were encountered: