Open konsumlamm opened 2 years ago
Another option would be to consider Zero the one with empty limbs (which is what https://github.com/SciNim/megalo does)
I did try some "small BigInt optimization", but when I benchmarked it, I haven't noticed any measurable improvements. But there's a possibility that my tests weren't great and/or my implementation wasn't good enough.
Currently,
BigInt
is defined as follows:It has the invariant that
limbs.len >= 1
.It might be worth it changing that to
This has several advantages:
BigInt
s require no allocation & pointer indirection.Disadvantages: