[MLton] building mlton from the sources

Vesa Karvonen vesa.a.j.k at gmail.com
Thu Jan 24 09:32:29 PST 2008


On Jan 24, 2008 5:48 PM, Gergely Buday <gbuday at gmail.com> wrote:
> Hi All,
>
> http://mlton.org/SelfCompiling
>
> writes "Building with SML/NJ takes some time (roughly 10 minutes on a
> 1.6GHz machine)". I built from the latest sources with mlton-20070826
> and it took 26 minutes to run through the self-compilation cycle
> twice. I have an AMD Athlon(tm) 64 Dual Core 4200+ (it's said this is
> equivalent to 2Ghz) with 4G of RAM.
>
> Is building with mlton so slower than building with sml/nj?

Note that usually on self-recompiles, MLton is compiled only once,
which cuts the time in half (or less).

> And, is it a proper result for such a machine?

Doesn't sound completely unreasonable.  On my 1 GB, 1.6 GHz, Pentium M
laptop it takes about 12 minutes to self-recompile MLton (with the
below Makefile changes).

If you want to speed up self-compiles with MLton, you could try
experimenting with the GC options.  On my 1G machine, I have the below
local changes in the Makefile to speed up self-compiles with MLton
*and* to save the def-use info while self-compiling (to avoid having
to do it separately).  The fixed-heap setting is effective on my
machine, because it has only 1GB of RAM (typically less than 900MB
available).  With the ram-slop option, GC takes much more time on my
machine.  Your machine has considerably more RAM, so you could try
with a bigger fixed-heap.

BTW, this won't speed up self-compiles, but compiling MLton with, for
example, -loop-passes 2, the resulting compiler might run slightly
faster.

-Vesa Karvonen

Index: mlton/Makefile
===================================================================
--- mlton/Makefile	(revision 6349)
+++ mlton/Makefile	(working copy)
@@ -18,7 +18,7 @@
 UP := upgrade-basis.sml
 PATH := $(BIN):$(shell echo $$PATH)

-FLAGS := @MLton ram-slop 0.7 gc-summary $(RUNTIME_ARGS) --
+FLAGS := @MLton fixed-heap 0.675g gc-summary $(RUNTIME_ARGS) --

 ifeq (self, $(shell if [ -x "$(BIN)/mlton" ]; then echo self; fi))
   # We're compiling MLton with itself, so don't use any stubs.
@@ -82,7 +82,7 @@
 	rm -f $(UP)
 	$(MAKE) $(UP)
 	@echo 'Compiling mlton (takes a while)'
-	mlton $(FLAGS) $(FILE)
+	mlton $(FLAGS) -prefer-abs-paths true -show-def-use mlton.def-use $(FILE)

 #! Pass $(PATH) to upgrade-basis because it is run via #!/usr/bin/env
 # bash, which resets the path.
@@ -94,7 +94,7 @@

 .PHONY: def-use
 def-use:
-	mlton -stop tc -prefer-abs-paths true -show-def-use mlton.def-use $(FILE)
+	mlton @MLton gc-summary fixed-heap 0.675g -- -stop tc
-prefer-abs-paths true -show-def-use mlton.def-use $(FILE)

 .PHONY: clean
 clean:



More information about the MLton mailing list