[erlang-questions] Why is erlc so quick to start?

Roger Lipscombe roger@REDACTED
Mon Jan 5 10:08:01 CET 2015

Loïc has mentioned that any Erlang package manager must be as quick to
start as 'erlc'. So, I figured that I'd take a quick look at how
'erlc' is started.

The code's in erts/etc/common/erlc.c, and it appears to do this:

    erlc +sbtu +A0 -noinput -mode minimal -boot start_clean -s
erl_compile compile_cmdline

For comparison, "erl -noinput -s init stop" takes, according to
/usr/bin/time, on average, 1.15 secs elapsed to exit, versus "erlc
+sbtu +A0 -noinput -mode minimal -boot start_clean -s init stop",
which takes 1.10 secs. This is with a Core i7-3930K @ 3.20GHz, running
from an SSD.

That's not much of a saving, but I guess it could make enough difference.

For another data point, I used "-s erlang halt" instead of "-s init
stop", and saw much bigger savings. The average time here was 0.10
secs. From a brief look, I don't know which of these is more relevant.

It's difficult to get a direct comparison with running the "erlc"
binary, because it doesn't spawn the VM if there's nothing to compile,
and if there is something to compile, it compiles it. So I wouldn't be
comparing like with like.

More information about the erlang-questions mailing list