[erlang-questions] Why is erlc so quick to start?
Roger Lipscombe
roger@REDACTED
Mon Jan 5 11:05:11 CET 2015
On 5 January 2015 at 09:14, Vlad Dumitrescu <vladdu55@REDACTED> wrote:
> 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.
Given foo.erl:
-module(foo).
-export([compile/0]).
compile() ->
compile:file("foo.erl"),
erlang:halt().
"erlc foo.erl" takes 0.18 secs.
"erl -noinput -s foo compile" takes 0.23 secs.
"erl +sbtu +A0 -noinput -mode minimal -boot start_clean -s foo
compile" takes 0.17 secs.
"+sbtu" doesn't seem to make any difference; "+A0" seems to
responsible for ~0.04 secs; "-mode minimal" for ~0.03 secs; "-boot
start_clean", again, seems to make no difference.
With an escript:
#!/usr/bin/env escript
%%! +sbtu +A0 -mode minimal -boot start_clean
main([]) ->
compile:file("foo.erl").
It takes ~0.17 seconds; without the %%! line, it takes ~0.23 seconds.
These are comparable to the above results.
These results aren't exactly scientifically rigorous. PC spec is as
given in my first email; Erlang is R16B03-1; OS is Linux Mint 17;
methodology was simply to run "/usr/bin/time whatever" at least 5
times and report the number that looked most like the mode.
More information about the erlang-questions
mailing list