Performance
===========

This page compares the performance of a number of SML compilers on a
range of benchmarks.  For a
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all[performance comparison]
of many different languages, including
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=mlton&sort=cpu[MLton],
see the http://shootout.alioth.debian.org/[Computer Language Shootout].

This page compares the following SML compiler versions.

* <:Home:MLton> 20051202
* <:MLKit:ML Kit> 4.1.4
* <:MoscowML:Moscow ML> 2.00
* <:PolyML:Poly/ML> 4.1.3
* <:SMLNJ:SML/NJ> 110.57

There are tables for <:#RunTime:run time>, <:#CodeSize:code size>, and
<:#CompileTime:compile time>.


== Setup ==

All benchmarks were compiled and run on a 2.6 GHz Celeron with 2G of
RAM.  The benchmarks were compiled with the default settings for all
the compilers, except for Moscow ML, which was passed the
`-orthodox -standalone -toplevel` switches.  The Poly/ML executables
were produced by `use`-ing the file, followed by a `PolyML.commit`.
The SML/NJ executables were produced by wrapping the entire program in
a `local` declaration whose body performs an `SMLofNJ.exportFn`.

For more details, or if you want to run the benchmarks yourself,
please see the <!ViewGitDir(mlton,master,benchmark)> directory of our
<:Sources:>.

All of the benchmarks are available for download from this page.  Some
of the benchmarks were obtained from the SML/NJ benchmark suite.  Some
of the benchmarks expect certain input files to exist in the
<!ViewGitDir(mlton,master,benchmark/tests/DATA)> subdirectory.

* <!RawGitFile(mlton,master,benchmark/tests/hamlet.sml)> <!RawGitFile(mlton,master,benchmark/tests/DATA/hamlet-input.sml)>
* <!RawGitFile(mlton,master,benchmark/tests/ray.sml)> <!RawGitFile(mlton,master,benchmark/tests/DATA/ray)>
* <!RawGitFile(mlton,master,benchmark/tests/raytrace.sml)> <!RawGitFile(mlton,master,benchmark/tests/DATA/chess.gml)>
* <!RawGitFile(mlton,master,benchmark/tests/vliw.sml)> <!RawGitFile(mlton,master,benchmark/tests/DATA/ndotprod.s)>


== <!Anchor(RunTime)>Run-time ratio ==

The following table gives the ratio of the run time of each benchmark
when compiled by another compiler to the run time when compiled by
MLton.  That is, the larger the number, the slower the generated code
runs.  A number larger than one indicates that the corresponding
compiler produces code that runs more slowly than MLton.  A * in an
entry means the compiler failed to compile the benchmark or that the
benchmark failed to run.

[options="header",cols="<2,5*<1"]
|====
|benchmark|MLton|ML-Kit|MosML|Poly/ML|SML/NJ
|<!RawGitFile(mlton,master,benchmark/tests/barnes-hut.sml)>|1.0|*|*|*|1.6
|<!RawGitFile(mlton,master,benchmark/tests/boyer.sml)>|1.0|*|10.1|1.9|3.1
|<!RawGitFile(mlton,master,benchmark/tests/checksum.sml)>|1.0|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/count-graphs.sml)>|1.0|7.3|60.7|4.2|3.8
|<!RawGitFile(mlton,master,benchmark/tests/DLXSimulator.sml)>|1.0|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/fft.sml)>|1.0|1.2|*|24.2|0.8
|<!RawGitFile(mlton,master,benchmark/tests/fib.sml)>|1.0|0.9|5.0|1.2|1.3
|<!RawGitFile(mlton,master,benchmark/tests/flat-array.sml)>|1.0|2.2|35.0|1041.6|13.4
|<!RawGitFile(mlton,master,benchmark/tests/hamlet.sml)>|1.0|*|*|*|3.1
|<!RawGitFile(mlton,master,benchmark/tests/imp-for.sml)>|1.0|2.8|63.0|5.1|5.6
|<!RawGitFile(mlton,master,benchmark/tests/knuth-bendix.sml)>|1.0|*|19.8|4.8|4.6
|<!RawGitFile(mlton,master,benchmark/tests/lexgen.sml)>|1.0|2.5|5.0|1.7|1.5
|<!RawGitFile(mlton,master,benchmark/tests/life.sml)>|1.0|1.7|30.6|7.7|1.4
|<!RawGitFile(mlton,master,benchmark/tests/logic.sml)>|1.0|*|9.4|1.2|2.1
|<!RawGitFile(mlton,master,benchmark/tests/mandelbrot.sml)>|1.0|4.2|34.0|51.1|1.3
|<!RawGitFile(mlton,master,benchmark/tests/matrix-multiply.sml)>|1.0|8.3|42.5|13.2|5.3
|<!RawGitFile(mlton,master,benchmark/tests/md5.sml)>|1.0|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/merge.sml)>|1.0|*|*|1.1|7.9
|<!RawGitFile(mlton,master,benchmark/tests/mlyacc.sml)>|1.0|1.5|8.2|1.2|2.2
|<!RawGitFile(mlton,master,benchmark/tests/model-elimination.sml)>|1.0|*|*|*|2.6
|<!RawGitFile(mlton,master,benchmark/tests/mpuz.sml)>|1.0|2.3|78.2|4.6|4.1
|<!RawGitFile(mlton,master,benchmark/tests/nucleic.sml)>|1.0|*|*|23.5|0.8
|<!RawGitFile(mlton,master,benchmark/tests/output1.sml)>|1.0|30.7|61.4|16.2|14.4
|<!RawGitFile(mlton,master,benchmark/tests/peek.sml)>|1.0|15.2|176.9|17.9|11.3
|<!RawGitFile(mlton,master,benchmark/tests/psdes-random.sml)>|1.0|5.0|*|*|2.7
|<!RawGitFile(mlton,master,benchmark/tests/ratio-regions.sml)>|1.0|2.0|34.7|2.1|5.4
|<!RawGitFile(mlton,master,benchmark/tests/ray.sml)>|1.0|*|14.8|22.3|0.8
|<!RawGitFile(mlton,master,benchmark/tests/raytrace.sml)>|1.0|*|*|*|3.3
|<!RawGitFile(mlton,master,benchmark/tests/simple.sml)>|1.0|1.7|19.3|7.3|2.4
|<!RawGitFile(mlton,master,benchmark/tests/smith-normal-form.sml)>|1.0|*|*|*|<:#SNFNote:{gt}1000>
|<!RawGitFile(mlton,master,benchmark/tests/tailfib.sml)>|1.0|1.0|51.9|3.2|1.4
|<!RawGitFile(mlton,master,benchmark/tests/tak.sml)>|1.0|1.2|17.0|1.3|2.0
|<!RawGitFile(mlton,master,benchmark/tests/tensor.sml)>|1.0|*|*|*|7.4
|<!RawGitFile(mlton,master,benchmark/tests/tsp.sml)>|1.0|3.4|31.8|*|17.7
|<!RawGitFile(mlton,master,benchmark/tests/tyan.sml)>|1.0|*|15.7|1.0|1.6
|<!RawGitFile(mlton,master,benchmark/tests/vector-concat.sml)>|1.0|1.2|20.4|2.0|20.4
|<!RawGitFile(mlton,master,benchmark/tests/vector-rev.sml)>|1.0|2.2|41.9|2.3|152.4
|<!RawGitFile(mlton,master,benchmark/tests/vliw.sml)>|1.0|*|*|*|2.5
|<!RawGitFile(mlton,master,benchmark/tests/wc-input1.sml)>|1.0|11.1|*|7.5|17.2
|<!RawGitFile(mlton,master,benchmark/tests/wc-scanStream.sml)>|1.0|22.1|*|203.7|11.5
|<!RawGitFile(mlton,master,benchmark/tests/zebra.sml)>|1.0|3.9|30.2|3.4|8.5
|<!RawGitFile(mlton,master,benchmark/tests/zern.sml)>|1.0|*|*|*|2.6
|====

<!Anchor(SNFNote)>
Note: for SML/NJ, the
<!RawGitFile(mlton,master,benchmark/tests/smith-normal-form.sml)>
benchmark was killed after running for over 25,000 seconds.


== <!Anchor(CodeSize)>Code size ==

The following table gives the code size of each benchmark in bytes.
The size for MLton and the ML Kit is the sum of text and data for the
standalone executable as reported by `size`.  The size for Moscow
ML is the size in bytes of the executable `a.out`.  The size for
Poly/ML is the difference in size of the database before the session
start and after the commit.  The size for SML/NJ is the size of the
heap file created by `exportFn` and does not include the size of
the SML/NJ runtime system (approximately 100K).  A * in an entry means
that the compiler failed to compile the benchmark.

[options="header",cols="<2,5*<1"]
|====
|benchmark|MLton|ML-Kit|MosML|Poly/ML|SML/NJ
|<!RawGitFile(mlton,master,benchmark/tests/barnes-hut.sml)>|103,231|*|*|*|433,216
|<!RawGitFile(mlton,master,benchmark/tests/boyer.sml)>|138,518|163,204|116,300|122,880|526,376
|<!RawGitFile(mlton,master,benchmark/tests/checksum.sml)>|52,794|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/count-graphs.sml)>|66,838|84,124|84,613|98,304|454,776
|<!RawGitFile(mlton,master,benchmark/tests/DLXSimulator.sml)>|129,398|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/fft.sml)>|64,797|80,240|84,046|65,536|434,256
|<!RawGitFile(mlton,master,benchmark/tests/fib.sml)>|47,738|18,588|79,892|49,152|415,488
|<!RawGitFile(mlton,master,benchmark/tests/flat-array.sml)>|47,762|23,820|80,034|49,152|410,680
|<!RawGitFile(mlton,master,benchmark/tests/hamlet.sml)>|1,256,813|*|*|*|1,412,360
|<!RawGitFile(mlton,master,benchmark/tests/imp-for.sml)>|47,626|19,372|80,040|57,344|400,424
|<!RawGitFile(mlton,master,benchmark/tests/knuth-bendix.sml)>|109,126|93,400|88,439|180,224|431,144
|<!RawGitFile(mlton,master,benchmark/tests/lexgen.sml)>|203,559|208,332|104,883|196,608|501,824
|<!RawGitFile(mlton,master,benchmark/tests/life.sml)>|66,130|78,084|83,390|65,536|414,760
|<!RawGitFile(mlton,master,benchmark/tests/logic.sml)>|106,614|116,880|87,251|114,688|440,360
|<!RawGitFile(mlton,master,benchmark/tests/mandelbrot.sml)>|47,690|77,004|81,340|57,344|404,520
|<!RawGitFile(mlton,master,benchmark/tests/matrix-multiply.sml)>|49,181|87,016|82,417|57,344|435,256
|<!RawGitFile(mlton,master,benchmark/tests/md5.sml)>|77,646|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/merge.sml)>|49,318|24,296|80,090|49,152|400,432
|<!RawGitFile(mlton,master,benchmark/tests/mlyacc.sml)>|507,431|473,748|148,286|2,850,816|820,336
|<!RawGitFile(mlton,master,benchmark/tests/model-elimination.sml)>|638,084|*|*|*|1,009,880
|<!RawGitFile(mlton,master,benchmark/tests/mpuz.sml)>|50,594|73,232|82,382|81,920|408,616
|<!RawGitFile(mlton,master,benchmark/tests/nucleic.sml)>|199,181|258,552|*|221,184|487,480
|<!RawGitFile(mlton,master,benchmark/tests/output1.sml)>|80,720|63,336|80,187|49,152|399,400
|<!RawGitFile(mlton,master,benchmark/tests/peek.sml)>|76,302|62,092|81,621|57,344|403,544
|<!RawGitFile(mlton,master,benchmark/tests/psdes-random.sml)>|48,402|25,196|*|*|421,944
|<!RawGitFile(mlton,master,benchmark/tests/ratio-regions.sml)>|73,914|95,924|87,482|73,728|443,448
|<!RawGitFile(mlton,master,benchmark/tests/ray.sml)>|183,243|108,848|89,859|147,456|493,712
|<!RawGitFile(mlton,master,benchmark/tests/raytrace.sml)>|265,332|*|*|*|636,112
|<!RawGitFile(mlton,master,benchmark/tests/simple.sml)>|222,914|192,032|94,396|475,136|756,840
|<!RawGitFile(mlton,master,benchmark/tests/smith-normal-form.sml)>|181,686|*|*|131,072|558,224
|<!RawGitFile(mlton,master,benchmark/tests/tailfib.sml)>|47,434|18,804|79,943|57,344|399,400
|<!RawGitFile(mlton,master,benchmark/tests/tak.sml)>|47,818|18,580|79,908|57,344|411,392
|<!RawGitFile(mlton,master,benchmark/tests/tensor.sml)>|97,677|*|*|*|450,672
|<!RawGitFile(mlton,master,benchmark/tests/tsp.sml)>|82,190|97,716|86,146|*|425,024
|<!RawGitFile(mlton,master,benchmark/tests/tyan.sml)>|134,910|137,800|91,586|196,608|477,272
|<!RawGitFile(mlton,master,benchmark/tests/vector-concat.sml)>|49,018|23,924|80,194|49,152|410,680
|<!RawGitFile(mlton,master,benchmark/tests/vector-rev.sml)>|48,246|24,104|80,078|57,344|410,680
|<!RawGitFile(mlton,master,benchmark/tests/vliw.sml)>|393,762|*|*|*|731,304
|<!RawGitFile(mlton,master,benchmark/tests/wc-input1.sml)>|101,850|129,212|85,771|49,152|404,520
|<!RawGitFile(mlton,master,benchmark/tests/wc-scanStream.sml)>|109,106|129,708|85,947|49,152|405,544
|<!RawGitFile(mlton,master,benchmark/tests/zebra.sml)>|141,146|41,532|83,422|90,112|419,896
|<!RawGitFile(mlton,master,benchmark/tests/zern.sml)>|91,087|*|*|*|479,384
|====


== <!Anchor(CompileTime)>Compile time ==

The following table gives the compile time of each benchmark in
seconds.  A * in an entry means that the compiler failed to compile
the benchmark.

[options="header",cols="<2,5*<1"]
|====
|benchmark|MLton|ML-Kit|MosML|Poly/ML|SML/NJ
|<!RawGitFile(mlton,master,benchmark/tests/barnes-hut.sml)>|8.28|*|*|*|1.37
|<!RawGitFile(mlton,master,benchmark/tests/boyer.sml)>|8.14|8.99|0.39|0.12|3.20
|<!RawGitFile(mlton,master,benchmark/tests/checksum.sml)>|5.45|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/count-graphs.sml)>|6.12|2.06|0.14|0.05|0.90
|<!RawGitFile(mlton,master,benchmark/tests/DLXSimulator.sml)>|9.81|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/fft.sml)>|5.95|1.32|0.11|0.05|0.69
|<!RawGitFile(mlton,master,benchmark/tests/fib.sml)>|5.45|0.60|0.05|0.02|0.22
|<!RawGitFile(mlton,master,benchmark/tests/flat-array.sml)>|5.33|0.61|0.04|0.01|0.25
|<!RawGitFile(mlton,master,benchmark/tests/hamlet.sml)>|85.70|*|*|*|88.87
|<!RawGitFile(mlton,master,benchmark/tests/imp-for.sml)>|5.37|0.73|0.05|0.01|0.25
|<!RawGitFile(mlton,master,benchmark/tests/knuth-bendix.sml)>|7.09|4.11|0.19|0.12|1.60
|<!RawGitFile(mlton,master,benchmark/tests/lexgen.sml)>|11.02|7.21|0.40|0.26|3.63
|<!RawGitFile(mlton,master,benchmark/tests/life.sml)>|5.84|2.16|0.10|0.04|0.64
|<!RawGitFile(mlton,master,benchmark/tests/logic.sml)>|7.02|4.82|0.22|0.09|1.68
|<!RawGitFile(mlton,master,benchmark/tests/mandelbrot.sml)>|5.41|0.75|0.06|0.02|0.29
|<!RawGitFile(mlton,master,benchmark/tests/matrix-multiply.sml)>|5.39|0.77|0.06|0.01|0.30
|<!RawGitFile(mlton,master,benchmark/tests/md5.sml)>|6.01|*|*|*|*
|<!RawGitFile(mlton,master,benchmark/tests/merge.sml)>|5.41|0.62|0.06|0.02|0.26
|<!RawGitFile(mlton,master,benchmark/tests/mlyacc.sml)>|24.70|40.69|3.35|1.08|18.04
|<!RawGitFile(mlton,master,benchmark/tests/model-elimination.sml)>|25.04|*|*|*|28.79
|<!RawGitFile(mlton,master,benchmark/tests/mpuz.sml)>|5.41|1.07|0.07|0.03|0.45
|<!RawGitFile(mlton,master,benchmark/tests/nucleic.sml)>|14.24|24.79|*|0.36|2.78
|<!RawGitFile(mlton,master,benchmark/tests/output1.sml)>|6.05|0.68|0.05|0.01|0.23
|<!RawGitFile(mlton,master,benchmark/tests/peek.sml)>|6.04|0.70|0.05|0.02|0.25
|<!RawGitFile(mlton,master,benchmark/tests/psdes-random.sml)>|5.39|0.75|*|*|64.13
|<!RawGitFile(mlton,master,benchmark/tests/ratio-regions.sml)>|6.63|4.02|0.21|0.11|1.50
|<!RawGitFile(mlton,master,benchmark/tests/ray.sml)>|9.51|3.02|0.15|0.08|1.03
|<!RawGitFile(mlton,master,benchmark/tests/raytrace.sml)>|13.92|*|*|*|5.08
|<!RawGitFile(mlton,master,benchmark/tests/simple.sml)>|11.40|13.19|0.43|0.21|3.76
|<!RawGitFile(mlton,master,benchmark/tests/smith-normal-form.sml)>|8.90|*|*|0.10|2.25
|<!RawGitFile(mlton,master,benchmark/tests/tailfib.sml)>|5.35|0.64|0.05|0.02|0.24
|<!RawGitFile(mlton,master,benchmark/tests/tak.sml)>|5.36|0.62|0.05|0.01|0.22
|<!RawGitFile(mlton,master,benchmark/tests/tensor.sml)>|8.75|*|*|*|2.81
|<!RawGitFile(mlton,master,benchmark/tests/tsp.sml)>|6.50|1.93|0.15|*|0.66
|<!RawGitFile(mlton,master,benchmark/tests/tyan.sml)>|8.86|6.25|0.30|0.17|2.28
|<!RawGitFile(mlton,master,benchmark/tests/vector-concat.sml)>|5.52|0.68|0.05|0.01|0.25
|<!RawGitFile(mlton,master,benchmark/tests/vector-rev.sml)>|5.33|0.64|0.05|0.02|0.26
|<!RawGitFile(mlton,master,benchmark/tests/vliw.sml)>|18.28|*|*|*|13.12
|<!RawGitFile(mlton,master,benchmark/tests/wc-input1.sml)>|6.85|0.68|0.07|0.02|0.27
|<!RawGitFile(mlton,master,benchmark/tests/wc-scanStream.sml)>|7.07|0.69|0.06|0.02|0.29
|<!RawGitFile(mlton,master,benchmark/tests/zebra.sml)>|8.57|2.30|0.09|0.04|0.78
|<!RawGitFile(mlton,master,benchmark/tests/zern.sml)>|6.20|*|*|*|0.65
|====
