Haxe 5 and BigInt

Hello \o/

First of all, I would like to express my excitement about the progress of the next haxe-5 generation: lots of cool new features on the horizon (i watched the haxeUP video, thanks also to Michael for the easy-to-understand introduction to tink_state *hugs)
Of course, I was also very pleased that try.haxe is now making the 5-preview version available for us all to test.
So what could be better than trying the new abitrary number spice first (^_^) …
so here some benchmarks in compared to my old (but not rotten;) “littleBigInt” haxelib:

littleBigInt 0.2.0:
Multiplicacci: https://try.haxe.org/#FD246cd5
Fibonacci: https://try.haxe.org/#49a6048e
Collatz: https://try.haxe.org/#c0326D05
CalcPi: https://try.haxe.org/#089c73Ea

haxe 5 BigInt:
Multiplicacci: https://try.haxe.org/#326a3210
Fibonacci: https://try.haxe.org/#CD8fc6C1
Collatz: https://try.haxe.org/#067cac58
CalcPi: https://try.haxe.org/#fFbf263a

The performance makes a very good impression and I’m glad that my old part still rocks, at least when it comes to multiplication. (what I am totally surprised about is why the calculation of Pi is so extremely slow with my old littleBig crutch *lol … maybe some one see why or where the bottleneck is in :wink: ? )

Well then, I’m looking forward to testing the new coroutines feature also soon…
wish everyone happy haxe programming experiences
& ~see\You/~^^

3 Likes

In my tests, both approaches have their advantages and disadvantages, so it seems crucial to examine both libraries and find an optimal solution.

JavaScript

littleBigInt 0.2.0:

  • Collatz 131 ms
  • Fibonacci 61 ms
  • Multiplicacci 10 ms :trophy:
  • CalcPi 10 ms :trophy:

Haxe 5 BigInt:

  • Collatz 84 ms :trophy:
  • Fibonacci 27 ms :trophy:
  • Multiplicacci 81 ms
  • CalcPi 80 ms
2 Likes

woah, why is CalcPi (littleBigInt) so fast by your tests ? (what “target/machin” or also by try.haxe ?)