2 ms·
Even without the shell and with epmd turned off we're still in the ball bark of 200-300ms: $ time erl -eval 'io:format("~s~n", [os:cmd("echo hello world")]),
by fredrikholm 3y ago
Even without the shell and with epmd turned off we're still in the ball bark of 200-300ms:
$ time erl -eval 'io:format("~s~n", [os:cmd("echo hello world")]), halt(0, [{flush, false}]).' -noshell -start_epmd false
hello world
real 0m0,332s
user 0m0,461s
sys 0m0,092s
I spent some time last year trying to get those numbers down but this is as far as I made it. Do you know of any more flags that might help?
- toast0 3y agoTry -boot no_dot_erlang A couple years ago that got me to 100 ms https://news.ycombinator.com/item?id=25243246 https://news.ycombinator.com/item?id=25243246 Today's measurements with FreeBSD 13.2 on the same Pentium G3470 time /bin/sh -c "echo hi" hi real 0m0.004s user 0m0.001s sys 0m0.002s time /usr/local/bin/bash -c "echo hi" hi hi real 0m0.006s user 0m0.007s sys 0m0.000s time /usr/local/lib/erlang26/bin/erl -eval 'io:format("hi~n"), halt(0, [{flush, false}])' Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns] [dtrace] [sharing-preserving] hi real 0m0.197s user 0m0.178s sys 0m0.018s time /usr/local/lib/erlang26/bin/erl -eval 'io:format("hi~n"), halt(0, [{flush, false}])' -noshell -start_epmd false -boot no_dot_erlang hi real 0m0.183s user 0m0.181s sys 0m0.011s This doesn't look very good, actually! FreeBSD has OTP 21-26 available through pkg, I ran the same thing on each of them several times to warm up, and get (real time): 21: 81ms 22: 81ms 23: 74ms 24: 129ms 25: 135ms 26: 177ms So maybe there's some new stuff that needs to be avoided now.
- fredrikholm 3y agoIt was your original post that set me on course for experimenting with startup times, cheers! Unfortunately, that final flag doesn't change much on 26 for me. IIRC I dropped a bunch of flags after concluding that no shell and no epmd were the only flags that I noticed improvements with.
- toast0 3y agoYeah, it looks like it got a lot worse. I don't think it's JIT, because I ran a test with a 32-bit version of OTP 26 (JIT is only available for 64-bit x86 and arm). But I'm not sure what it is. Send me an email (in profile), and I'll try to find some time to look closer.