Concerning Time.TimeDiff

Keith Wansbrough
Thu, 19 Jun 2003 17:04:37 +0100

Alistair Reid writes:

> I suspect Integer could be optimized (by recognizing that most uses of Integer 
> are for values that fit in 31 bits) so that the difference is pretty minimal.  
> but this would have limited effect on a date like 19 June 2003 which is (very 
> roughly) 2^69 picoseconds since the epoch.

It *is* optimised on GHC: libraries/base/GHC/Num.lhs says

  -- | Arbitrary-precision integers.
  data Integer	
     = S# Int#				-- small integers
  #ifndef ILX
     | J# Int# ByteArray#			-- large integers
     | J# Void BigInteger                 -- .NET big ints
  foreign type dotnet "BigInteger" BigInteger

This doesn't change your basic point, though, that two Int64s will
probably be faster than one Integer.

--KW 8-)