[Haskell-cafe] Re: Chameneos

Bulat Ziganshin bulatz at HotPOP.com
Sat Jan 7 03:59:08 EST 2006

Hello Simon,

Friday, January 06, 2006, 7:11:41 PM, you wrote:

>>>I'm not keen on using explicit unboxed values in these benchmarks, since
>>>it looks so ugly.  In most cases you can convince GHC to do the unboxing
>>>for you, and I'm pretty sure it should be the case here too.  Just use
>>>ordinary Ints.
>>>It's interesting you're getting some benefit from using integers instead
>>>of enumerations.  We've known for a while that enumerations in GHC
>>>aren't optimised as well as they could be.

the same is for Int32 (and i think other fixed-width integrals). i just
noticed that one simple loop in my program allocates 2.5 times more
data and works 2 times slower when loop variable switched from Int
to Int32

it is very likely that Joels unpickling code suffers from this problem
- all data in his program are defined with fixed-width types

it is also likely that HashTable package suffers from this problem - it
uses Int32 to represent hash keys

can that be fixed, at least for enums and Int32/Word32 (Int64/Word64)?

btw, i just noticed one more "feature" that is documented nowhere -
(explicit) inlining of default class methods doesn't work, so that:

> class C where
>   f :: ...
>   f = ...
>   {-# INLINE f -#}
> instance C T where

doesn't inline `f`, so i need to switch to:

> class C where
>   f :: ...

> instance C T where
>   f = ...
>   {-# INLINE f -#}

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list