3 ms·
Lead author of Doppio here! This is quite cool. I don't recognize the authors of this work, so I was unaware of the project and was surprised to see it on the f
by jvilk 10y ago
Lead author of Doppio here! This is quite cool. I don't recognize the authors of this work, so I was unaware of the project and was surprised to see it on the front page of HN!
If you find any issues with Doppio or have any requests, feel free to open up an issue on our GitHub issue tracker.
- spot 10y agodoppio sounds awesome. from the paper: Numeric support. Direct support for 64-bit integers would enable languages to efficiently represent a broader range of numeric types in the browser. The DOPPIOJVM uses a comprehensive software implementation of 64-bit integers to bring the long data type into the browser, but it is extremely slow when compared to normal numeric operations in JavaScript. -- how far is this from being solved?
- jvilk 10y agoThanks! I hope Doppio can become useful to many more people. :) There is a proposal for value types [0] that Niko Matsakis [1] and Brendan Eich [2] talked about a couple of years back and could be used to implement 64-bit numbers in JS, but I'm still waiting for an implementation or a more complete proposal. Looks like it might be dead in the water, as the proposal hasn't been edited in quite some time, but I do not have my finger on the pulse of browser standards so I could be wrong. [0] http://wiki.ecmascript.org/doku.php?id=strawman:value_objects http://wiki.ecmascript.org/doku.php?id=strawman:value_object... [1] http://smallcultfollowing.com/babysteps/blog/2014/04/01/value-types-in-javascript/ http://smallcultfollowing.com/babysteps/blog/2014/04/01/valu... [2] http://www.slideshare.net/BrendanEich/value-objects http://www.slideshare.net/BrendanEich/value-objects
- sjrd 10y agoYou could use (the compiled and optimized version of) the implementation we have in Scala.js: https://github.com/scala-js/scala-js/blob/master/library/src/main/scala/scala/scalajs/runtime/RuntimeLong.scala https://github.com/scala-js/scala-js/blob/master/library/src... It is significantly faster, especially for arithmetic operations, and dramatically so for division, remainder, as well as `toString()` (up to 100x speedup). It also contains the unsigned variant of operations (for java.lang.Lond.divideUnsigned for instance).
- jvilk 10y agoOh, nice! I'll take a look at that when I next get the chance. I assumed that Closure's Long library, which is based on GWT's Long implementation, would be well-optimized, and never looked into an alternative.