DeepFlatten - MLton Standard ML Compiler (SML Compiler)

MLton MLTONWIKIVERSION | DeepFlatten |
Home Index

Deep flatten is an optimization pass for the SSA2 IntermediateLanguage, invoked from SSA2Simplify.

## Description

This pass flattens into mutable fields of objects and into vectors.

For example, an `(int * int) ref` is represented by a 2 word object, and an `(int * int) array` contains pairs of `int`s, rather than pointers to pairs of `int`s.

## Implementation

deep-flatten.sig deep-flatten.fun

## Details and Notes

There are some performance issues with the deep flatten pass, where it consumes an excessive amount of memory.

- http://mlton.org/pipermail/mlton/2005-April/026990.html

- http://mlton.org/pipermail/mlton-user/2010-June/001626.html

A number of applications require compilation with `-drop-pass deepFlatten` to avoid exceeding available memory. It is often asked whether the deep flatten pass usually has a significant impact on performance. The standard benchmark suite was run with and without the deep flatten pass enabled when the pass was first introduced:

- http://mlton.org/pipermail/mlton/2004-August/025760.html

The conclusion is that it does not have a significant impact. However, these are micro benchmarks; other applications may derive greater benefit from the pass.

Last edited on 2010-06-01 17:13:13 by MatthewFluet.