Closed pulyaevskiy closed 8 years ago
I think the original rationale may have been that Int64List is a core package while the bignum package is a port of some JS implementation. It works, but the code is really dirty. And even though bignum is optimized for dart2js use, it is not necessary better when using the Dart VM. (I have not seen any benchmarks on this, though.)
Tests run successfully for me in the VM. Sadly testing in the browser using pub run test --platform "browser"
is not possible due to the use of the .pem
files.
Otherwise seems fine, so thanks!
I see, so the "ideal" solution in this case would be to replace bignum
completely with dart:typed_data
(avoiding Int64)?
@pulyaevskiy Int64List
is a class from typed_data
... But there is no implementation for integers of infinite size.
Another big integer implementation is the one used by the rational and decimal packages: https://github.com/a14n/dart-rational/blob/master/lib/bigint.dart
The implementation is a lot cleaner, but I suspect it to be less performant when compiled to JS, because the current bignum implementation is taken from an optimized JS implementation.
Hey,
This is an attempt to remove dependency on Int64List and replace it with BigInteger. It seems that there is everything needed already and I'm not sure why original implementation used Int64List.
In any case, tests are passing.
Addresses #18 .