I recently released version 1.0.1 of elm-natural. I worked on improving the performance of the arithmetic operations, specifically
mul , and
divModBy I switched from a straightforward divide and conquer algorithm to a really neat but complicated divide-and-correct long division algorithm that’s described in this paper.
mul I started using the Karatsuba algorithm for sufficiently large numbers. In this case, numbers with more than 1000 base-2^26 digits or a little more than 7000 decimals digits.
Check out GitHub - dwayne/elm-natural at 1.0.1 to see the performance results and to learn how it compares against
Chrome benchmark reports
The benchmark report for version 1.0.0.
The benchmark report for version 1.0.1.
It was really satisfying to see how division with remainder went from 1,891 runs/second to 10,987 runs/second.