[MLton-user] timing anomoly

Ville Laurikari ville at laurikari.net
Mon Dec 3 23:06:35 PST 2007


On Mon, Dec 03, 2007 at 08:27:35PM -0500, Sean McLaughlin wrote:
>   Using -inline 1000 worked for the test example, but in the context
> of a large program it is now taking a very long time to compile.  I
> killed the process after 30 minutes.  Is there a way to get the fast
> behavior (%10 faster than GCC -O2) without such compilation time
> increases?

You can try experimenting with different optimization settings.  For
example, "-loop-passes 2" does an extra round of inlining which seems
to help at least in your small example.  It might work for your bigger
program as well without blowing up the compilation time.

To track which compilation pass is taking most time, you can use
"-verbose 2".  For example, the "knownCase" pass can take a lot of
memory when using a very high inline threshold, slowing compilation
down to a crawl due to swapping.  I've found that in some situations
it helps to limit the heap size to avoid excessive swapping.  To do
this, you can run MLton like this:
  "mlton @MLton max-heap 1700M -- <normal command line parameters go here>"
1.7 gigs might be a good limit for a machine with 2 gigs of RAM.  Much
more than that is sure to cause a lot of swapping.

You can see all expert options with "-expert true".  Note that these
options are something which are prone to vanish or change over time,
and are usually undocumented (except in the code).  Caveat emptor :)

--
http://www.iki.fi/vl/



More information about the MLton-user mailing list