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

Vlad Dumitrescu vladdu55@REDACTED
Mon Jan 5 10:14:12 CET 2015


Hi!

Maybe you can compare "erlc myfile" with "erl -s compile file myfile"? Or
start some other code that does something relevant, with and without the
magic arguments.

I believe that a big part of the savings is due to the differences in code
loading, which "init:stop" or "erlang:halt" might not trigger.

regards,
/Vlad

On Mon, Jan 5, 2015 at 10:08 AM, Roger Lipscombe <roger@REDACTED>
wrote:

> 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.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150105/edc1d410/attachment.htm>


More information about the erlang-questions mailing list