On Sunday, June 19, 2016 at 10:20:11 PM UTC-5, Tim Holy wrote: > > Presumably if someone sat down and implemented similar operations in > pure-julia using, say, > tuples, it would blow away what we have now.
Proof-of-principle in this gist: https://gist.github.com/timholy/1c557c722359ffe6022a858b0cb8aa80 julia> x = TupleBigInt.TBigUInt((0xffffffff, 0xffffffff, 0xffffffff, 0x00000000)) TupleBigInt.TBigUInt{4}((0xffffffff,0xffffffff,0xffffffff,0x00000000)) julia> x+x TupleBigInt.TBigUInt{4}((0xfffffffe,0xffffffff,0xffffffff,0x00000001)) julia> a = fill(x, 10^5); julia> b = [BigInt(1) for i = 1:10^5]; julia> a+a; julia> b+b; julia> @time 1 0.000000 seconds (3 allocations: 144 bytes) 1 julia> @time a+a; 0.000539 seconds (7 allocations: 1.526 MB) julia> @time b+b; 0.022195 seconds (300.01 k allocations: 6.867 MB) A 40x speed up even without the BigInt version triggering garbage collection (it would be an even larger difference if it did). However, note this is "finite-precision," though there's no upper limit on how large that precision is. To make it arbitrary-precision, we need a version of `NTuple` where `N` is not a parameter. That would take more work in core Julia. Best, --Tim