Concerning Time.TimeDiff

Simon Marlow
Thu, 19 Jun 2003 17:38:39 +0100

> > ...and I don't think it's entirely given that two 64 bit=20
> numbers will
> > be faster than one Integer.
> I do.  the implementation of Integer requires traversing additional=20
> indirections to an array of bits, reading the size of the operands,=20
> allocating space for the result, etc.  It's a lot of work even if the=20
> arguments and result are simple values like 0 or 1.

I'm not sure I believe that.  Compare:

   data T =3D T Int64 Int64
   newtype T =3D T Integer

In pure space terms, with GHC, the first rep takes 9 words.  The second
probably takes 8 words, assuming 3 words for the integer value.  The
second version is probably faster at most things, too.

The fastest representation would be

  data T =3D T !Int64 !Int64

and compile with -funbox-strict-fields to remove two indirections and
two unnecessary bottoms in the domain.

Nevertheless, I still think this is all moot.