-
Notifications
You must be signed in to change notification settings - Fork 381
Description
GWT's existing long emulation was last updated in 2015, with a few assumptions that might no longer be true. Among other things, it retains the earlier assumption that 24bit ints are faster to operate on than larger values. Unfortunately, there appear to be no public benchmarks (the old gwt-benchmark repo only has add/multiply benchmarks, and add is all "Small" values), so we might need to work up some acceptable examples to do this work.
Contrast with J2CL's current implementation of long, which uses closure-library's own long.js (intended to reflect java long behavior as well). This implementation uses two 32bit values, occasionally splitting to 16bit values for operations like add/multiply/etc (though not bitwise operations), whereas GWT operates on 13 bit values, and appears to end up doing more work.
Also consider BigInt - with the demise of IE11, this should be well supported. This may require introducing changes to the JS AST or JSNI parser.