[Haskell-cafe] Understanding allocation behavior

David F. Place d at vidplace.com
Sat Apr 8 14:00:20 EDT 2006


On Apr 8, 2006, at 4:24 AM, Bulat Ziganshin wrote:

> foldBits can be made faster (may be) by adding strict annotations:
>
> foldBits :: Bits c => (a -> Int -> a) -> a -> c -> a
> foldbits _ z bs | z `seq` bs `seq` False  = undefined
>
> foldBits' :: Bits c => (a -> Int -> a) -> Int -> c -> a -> a
> foldbits' _ i bs z | i `seq` bs `seq` z `seq` False  = undefined

Indeed, I had tried this.  It is slower for reasons that are  
mysterious to me.

--------------------------------
David F. Place
mailto:d at vidplace.com



More information about the Haskell-Cafe mailing list