strange real timings partly explained

Stephen Weeks MLton@sourcelight.com
Wed, 20 Jun 2001 10:06:57 -0700


> I'm  a bit nervous about just aligning all objects mod 8.  For one thing, you
> would have to re-arrange objects so that the doubles  all  come  together  if
> there  are  lots of doubles and other things, so that you only need at most 1
> pad.  I.e., you would want to store
>     int * double * int * double
> as
>     int * int * double * double

We already do this.  See the sortTypes function in backend.fun, which arranges
tuples so that all doubles come first, then all words, then all bytes, then any
padding so that the object size is zero mod 4.

> For another, it can cost you a bit of space.   The  worst  case  is  probably
> something  like  a  list of Real64.real objects, where the average of 4 bytes
> wasted is going to be noticable.

Yeah, that's annoying.

> Next is the GC slow down.

True.  

Both of the previous problems argue for just trying stacks first.

> At any rate, the first thing to do, which should be trivial, is to just  make
> sure that non-stack non-heap double variables are stored aligned.

Agreed.