The size of things

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


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

> Thanks for all your help, though!

One interesting(?) observation, 

using a custom data type of

        data STuple = STuple !Int Foo

is slightly less efficient than using a normal tuple

        (Int,Foo)

Seems to go against theory, in which STuple should use three words
plus the Foo, while (,) should use three words plus the Foo, plus two
for the Int.  Perhaps the Ints are constructed anyway, since they are
inserted from a function parameter?  Sounds reasonable, I suppose;
memory use seemed to be the same (from "top"), and there was only a
speed difference.

And one more thing, would parametrised types make a difference?
E.g. my array is

        data MyArray label elts = MA label (Array Int elts)

which means I have

        data Foo l a = Foo (MyArray l a) !Int

and so on.  As far as I can see, this shouldn't matter (a heap object
is a heap object), but am I seeing far enough, I wonder?

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