swift-numerics icon indicating copy to clipboard operation
swift-numerics copied to clipboard

[BigInt tests] βœ…πŸ° Codable

Open LiarPrincess opened this issue 2 years ago β€’ 0 comments
trafficstars

Please read the #242 Using tests from β€œViolet - Python VM written in Swift” before.


🐰 Discussion

Currently Codable uses description which is a String with radix 10.

Following options may be better:

  • String with radix 32
    • βœ… human readable - just like current format; not sure if we care about this property
    • βœ… much shorter in transport - though it may compress a bit worse
    • βœ… faster to encode/decode - though the current implementation is slow
  • Binary - just an array of UInt32 with sign
    • ❌ not human readable
    • βœ… ultra compact
    • βœ… ultra fast to encode/decode

We need to remember that BigInt can get really big. In [BigInt tests] πŸ’€ Init from float 754 we operate on integers that have 3000 digits with 32 radix. With radix 10 they would be much longer.

LiarPrincess avatar Feb 03 '23 13:02 LiarPrincess