[MLton] flattening of arrays and vectors

Stephen Weeks MLton@mlton.org
Thu, 12 Aug 2004 16:23:12 -0700

Flattening of arrays and vectors passes all regressions, benchmarks,
and self compiles.  It is now enabled by default.

If you want to see if it has any effect on your program, try compiling
with and without -drop-pass deepFlatten.  The name "deepFlatten" is
because the pass does more than just array flattening.  It also does
flattening into ref cells (e.g. an (int * int) ref is represented
without an additional indirection to the tuple).

The pass didn't have much of an effect on the benchmarks -- in fact,
it only kicked in on the following ones.

MLton0 -- mlton -drop-pass deepFlatten
MLton1 -- mlton 

run time ratio
benchmark         MLton1
flat-array          0.64
hamlet              1.00
mlyacc              1.00
model-elimination   1.00
raytrace            1.00
simple              1.00
tyan                1.02
vliw                1.04
zebra               0.88

benchmark            MLton0    MLton1
flat-array           52,515    52,339
hamlet            1,295,249 1,295,441
mlyacc              549,030   549,622
model-elimination   674,252   674,124
raytrace            301,955   302,083
simple              279,292   279,228
tyan                183,577   183,449
vliw                431,882   431,946
zebra               162,361   162,441

These numbers include a new micro-benchmark, flat-array.sml, that I
added to show what's possible.

Please try out the compiler on your programs and report any
interesting effects.

This is the last major addition that I planned on before doing an
experimental release, which will begin the process leading up to our
(hopefully September) public release.