[MLton] Vector len passed to MakeFormalsRel

Lukasz S Ziarek lziarek@cs.purdue.edu
Sat, 28 Feb 2004 14:58:03 -0500 (EST)

On Fri, 27 Feb 2004, Stephen Weeks wrote:

> > Here is a short snippet of output from model-elimination running my
> > flattener. The numbers are the lengths of the vectors passed to
> > MakeFormalsRel.
> ...
> > MakeFormalsRel 3656
> That's a lot of arguments to one function!  Conservatively, that could
> take about 80M (= 3656^2 * 1/2 * 12) of space for one equivalence
> relation.  This certainly looks like the problem.

Right, with arbitrary nesting depth for a tuple it seems like that should
be a cap as to how far we flatten down. The main idea behind the flatten
all case was to get numbers so we could compare some more interesting
labelings for a program. Also, it illustrates very well the potential
short commings, as well as benefits of flattening, by examining the
"extreme" case. For those interested in the last two benchmarks, I ran
both without the redundant pass.

MLton0 -- /homes/lziarek/mlton/build/bin/mlton -flatten false -drop-pass
redundant -keep-pass flatten
MLton1 -- /homes/lziarek/mlton/build/bin/mlton -flatten true -drop-pass
redundant -keep-pass flatten
run time ratio
benchmark         MLton0 MLton1
hamlet              1.00   1.22
model-elimination   1.00   1.59
benchmark            MLton0    MLton1
hamlet            1,329,027 2,398,927
model-elimination   662,434 2,199,542  <- big increase in code size
compile time
benchmark         MLton0  MLton1
hamlet             27.72  376.05
model-elimination  13.13 1250.04 <- yikes!
run time
benchmark         MLton0 MLton1
hamlet             14.98  18.29
model-elimination  34.08  54.30

In both cases there is a large explosion in code size, mainly due to the
enormous amount of variables being passed around. I am hopefull for better
numbers once the "smart" labeling is implimented.