[MLton] two more optimal flatten all algorithms, benchmarks

Stephen Weeks MLton@mlton.org
Tue, 9 Mar 2004 19:25:56 -0800


> Both of these algorithms still use the flatten all principle, but
> they try to minimize coercions by doing them as early as
> possible.
...
> MLton0 -- /homes/lziarek/mlton/build/bin/mlton -flatten false
> MLton1 -- /homes/lziarek/mlton/build/bin/mlton -flatten true
> run time ratio
> benchmark         MLton0 MLton1
> barnes-hut          1.00   1.07

You might make the argument to -flatten something more complicated
than a boolean, so that you can decide on the command line between
multiple flattening strategies.  See, e.g. -limit-check.  Once you've
done this, you could then run the benchmarks with -flatten {a,b,c} to
compare several strategies in one table.

Also, in addition to the run times, it would be nice to see the total
amount of allocation, at least for the benchmarks where the run times
are significantly different.  You might also want to play around with
-profile alloc to see if you can learn why the allocation behavior
changes, and hopefully get some ideas on helpful heuristics.