The size of things

Ketil Z. Malde ketil@ii.uib.no
14 Feb 2002 15:04:12 +0100


While waiting for the gurus to bestow upon me fragments of their
wisdom, I've stumbled further on my path to enligthenment:

ketil@ii.uib.no (Ketil Z. Malde) writes:

> E.g. how much [space] for [...] a data type with only nullary data
> constructors -- should I use Word8s instead?

>From my superficial testing

        data Alphabet = A | B | C | D

is no worse than using Word8.  Is this a correct observation?  Would
it change if I somehow managed to get things to work with Word8#
instead, or will the compiler automatically unbox things when I stuff
them in tuples, lists or arrays anyway?  The GHC docs seem to
discourage using unboxed types.

(BTW, it took me a while to discover that Word8 hides in PrelWord.  I
may have missed some obvious place to look, but perhaps it could be
better documented?)

> I realize I can use profiling to determine heap use, 

Actually, I can't.  Binaries created with ghc -prof -auto-all
segmentation fault on startup.  This is GHC 5.02.1 installed from an
RPM on a RH7.2 box.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants