Comments (4)
@lgemeinhardt exactly, plus add tests, that's what this ticket is for. It should be just as easy as you suggested. I'd avoid the copy if we can help it, and have BigInteger(byte[]) call the new one with 0, arr.length - it shouldn't make a difference in the compiled output if you don't use the new ctor, since the old one will get inlined and putBytesNegativeToIntegers
/putBytesPositiveToIntegers
already read the length of the array anyway.
from gwt.
Speaking of BigInteger, all browsers except IE support BigInt
(just sayin')
from gwt.
If you're interested, it's all yours, file a ticket on what we can do to make that make more sense?
Jsinterop-base already has a JsBigInt type - just an interface, no members, but elemental2-core fills in the rest. If you're just looking at using it in specific "treat it like any other Object" cases that might be enough, but making GWT emit bigint literals might be tricky - gwt's js ast is basically es3, so adding a new JsLiteralValue might not be entirely seamless (esp when following the rules about not mixing numbers and bigints). Using bigint for long
values that don't fit in an int32 could make sense though, at least at a glance, but mixing operation might be gross (in Java, long * int is a long, in js you can't mix of course).
With regards to performance, is bigint comprehensively better than regular numeric math? Gwt's BigInteger is already just plain integers (so no dealing with long math). At a glance, the emulation might end up producing smaller output, and some operations like remainder()...
With no numbers to back me up, I'd guess there would be bigger wins replacing the int[] digits
with a Int32Array
than bigint for bit/byte-wise operations (de/serializing values, checking if bits are set), but likely better performance for BigInteger-BigInteger operators for bigint, plus smaller generated code.
from gwt.
Why not simple use the code of BigInteger(byte[]) and extend this to take length and offset (missing constructor) and copy the array in the beginning (or change the code to handle length and offset – whatever is easier) and let the (now missing) BigInteger(byte[]) constructor use the newly created one (with zero as offset and array length)?
from gwt.
Related Issues (20)
- StackTraceDeobfuscator sometimes produces total nonsense HOT 5
- Regression in jsinterop varargs causing internal compiler error HOT 3
- Tutorial: webAppCreator deprecated but necessary for tutorials HOT 2
- Need a method to run DevMode on systems without GUI support HOT 1
- SuperDevListener is not correctly build includeJsInteropExports/excludeJsInteropExports args
- Issue with tomcat version of GWT 2.11 for class javax.validation.Path HOT 8
- JDK 17 and GIN HOT 16
- SDM BindException: Address already in use
- GWT compiling issue in java 11 HOT 2
- Spurious incremental CompilerTest failure
- GWT 2.11 and Jetty 9.4.54.v20240208 error running in IntelliJ 2024.1 Ultimate HOT 3
- SDM (Super Dev Mode) does not work with a strong CSP (Content Security Policy)
- Draft compile with compiler.stackMode=strip seems to break stack trace deobfuscation with sourcemaps HOT 1
- Upgrade to HtmlUnit 3.9.0 or 4.1.0 HOT 2
- Upgrade icu4j to a version > 63.1
- Memory leak in stored exceptions HOT 8
- Issue with com.google.gwt.i18n.client.TimeZone in GWT 2.11 for Africa/Cairo Time Zone HOT 4
- Add Java 9 BigInteger methods sqrt and sqrtAndRemainder
- GWT from 2.9 to 2.11 Migration Issue Could not find com.google.gwt:gwt-codeserver:2.11.0. HOT 1
- Remove onLoadErrorFn/onPropertyErrorFn, or make them easier to disable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt.