Int vs Word performance?

Simon Marlow marlowsd at
Fri Feb 27 11:34:37 EST 2009

Claus Reinke wrote:
>>> Here is a trivial example with drastic difference between
>>> T = Int and T = Word (~2.5x here):
>>>    main = print $ foldl' (+) 0 [1..100000000::T]
> ..

> A quick grep shows almost no specialization at all for Word, or for
> IntXX/WordXX (see below). Still, none of that seems to explain the
> example repeated at the top of this message.

The Enum instance for Int uses specialised implementations of enumFromTo 
and friends, whereas the Word version uses the generic integralEnumFromTo.


More information about the Glasgow-haskell-users mailing list