[MLton] Flatten Benchmarks

Matthew Fluet fluet@cs.cornell.edu
Thu, 26 Feb 2004 14:27:30 -0500 (EST)

> programs.  Also I want to see what performance can be gained from
> flattening refs of tuples, into refs of single elements. Currently
> references are a "choke point" that forces a coercion, potentially
> building up a very complex tuple structure.

That's an interesting idea.  Obviously you need to be careful in the
transformation to preserve the semantics of reference equality.
It'll be interesting to see the benchmark results for something like that.
Have you seen situations like this in the benchmarks?  It's not completely
clear that ref of tuples into a (flattened) tuple of refs will be a win;
certainly separating them out opens up the opportunity to do some
optimization on each element.  On the other hand, if the individual
elements end up having pointer's, then you pay for the write barrier at
each ref update.  So, I could see it going either way.  Possibly guiding
the tranformation to favor pointerless elements would be a further

> nucleic             1.00   0.27     <-- worst case

Not too surprising if you look at the code; some really huge tuples of
floats, and floats are expensive to move around.

> psdes-random        1.00   1.49     <-- best case

I find that a little surprising, as there doesn't seem to be much for any
flattener to do in the code.