The reason BigInt was there was to allow for calculations of 1000! or larger (which was the original intent). However, I don't see how this alone could explain the timing differences. For example, in my original code, the recursive function
- Created one new BigInt
- Compared two BigInts
- Multiplied two BigInts
- Subtracted 2 BigInts
The non-recursive function
- Created 2 BigInts
- Multiplied 2 BigInts
In other words, are you saying that memory allocation for one extra BigInt is
that slow??