Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / WholeProgramOptimization.adoc
CommitLineData
7f918cf1
CE
1WholeProgramOptimization
2========================
3
4Whole-program optimization is a compilation technique in which
5optimizations operate over the entire program. This allows the
6compiler many optimization opportunities that are not available when
7analyzing modules separately (as with separate compilation).
8
9Most of MLton's optimizations are whole-program optimizations.
10Because MLton compiles the whole program at once, it can perform
11optimization across module boundaries. As a consequence, MLton often
12reduces or eliminates the run-time penalty that arises with separate
13compilation of SML features such as functors, modules, polymorphism,
14and higher-order functions. MLton takes advantage of having the
15entire program to perform transformations such as: defunctorization,
16monomorphisation, higher-order control-flow analysis, inlining,
17unboxing, argument flattening, redundant-argument removal, constant
18folding, and representation selection. Whole-program compilation is
19an integral part of the design of MLton and is not likely to change.