[MLton] Backends

Matthew Fluet fluet@cs.cornell.edu
Fri, 14 Nov 2003 08:13:11 -0500 (EST)


> another question about the backends: how much slower is the C backend
> than the native code-generation backends?

It's not too bad these days; the native backend hasn't received much of an
overhaul since it was originally written (and virtually every other part
of the compiler has since then).  Unfortunately, the last benchmarks I can
find in the mail archive are from about a year ago:

http://www.mlton.org/pipermail/mlton/2002-November/013342.html

The default C-backend corresponds to MLton3, which does an arithmetic test
for overflow before doing the operation.  So, generally one can expect no
worse than a factor of 2 slowdown with the C-codegen, and usually much
better.  (The really bad benchmarks on that page do correspond to
arithmetic heavy programs, where using the native codegen wins out using
the processor overflow flags rather than doing comparisons.)

-Matthew