Patch for Word64

Simon Marlow simonmar at
Wed Nov 23 06:28:26 EST 2005

On 21 November 2005 14:57, Matt wrote:

> I was doing some work with Word64 and noticed that it was about 3
> times slower than Int64. The reason appears to be expensive
> conversions from Int64# to Word64# and vice versa. I modified the
> libraries to remove the conversion overhead, and the result is that
> Int64# and Word64# now have equal performance, at least on the domain
> that I tested (==, +, -). 
> I can't check into the tree, so I was told to send my changes to this
> list. Could someone else check them in? I have attached a patch file
> representing my changes.

Thanks for the patch - but could you try this instead?

  int64ToWord64# = unsafeCoerce# 
  word64ToInt64# = unsafeCoerce#

this should reduce the cost of the conversions to zero, which is a
simpler way to fix the performance bug (if it works).

If you confirm that this also improves performance, I'll commit it.  If
not, I'll commit your patch instead.


More information about the Glasgow-haskell-users mailing list