[Haskell-cafe] forLoop + strict State monad is much faster than foldl'
patrick.john.wheeler at gmail.com
Thu May 1 14:00:57 UTC 2014
Int has a tight loop for `EnumFromTo`
On the other hand look at `EnumFromTo` for word32
It calls `integralEnumFromTo`
:: Integral a => a -> a -> [a]
n m = map fromInteger [toInteger n .. toInteger m]
That is right you get converted to an Integer, then back again.
This seems to be the problem with all loops that use `Word32` and
It looks like you could add a better `EnumFromTo` for `Word32` and you
would close the gap between the loops that are using `EnumFromTo` and those
that are not.
On Tue, Apr 29, 2014 at 11:35 AM, Niklas Hambüchen <mail at nh2.me> wrote:
> Interestingly, the discrimination against Word32 does not end here:
> When compiling with -fllvm
> we can see that the forLoop + strict State monad is completely compiled
> away to a no-op for Int, but not for Word32.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Patrick.John.Wheeler at gmail.com
Patrick.J.Wheeler at rice.edu
Patrick.Wheeler at colorado.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe