[erlang-questions] Why erlang's computing performance is enormously less than c++

Richard Carlsson <>
Sat Nov 12 10:53:09 CET 2016


New as of 2001 or so. :-) Inlining is documented towards the bottom of this
page: http://erlang.org/doc/man/compile.html

However, it only describes the inline_size option. There is also the
inline_effort limit, which can be increased from the default 150 at the
expense of compile time (its purpose is to ensure that the automatic
inliner does not get bogged down in any particular part of the code). And
then there's the slightly experimental inline_unroll, which is actually
more of a side effect of the normal inlining behaviour if you just allow it
to repeat itself on loops.

The interaction between the unroll limit and the size/effort limit is not
obvious (and could maybe be improved - I haven't looked at that code for 15
years). In particular, the size limit seems to need bumping from the
default 24 to about 200 or more for unrolling to happen, depending on the
size of the loop body, and the effort limit also needs raising to at least
500 or 1000. I suggest you use the 'to_core' option and inspect the result
until you find settings that work for your program. If you want to use
unrolling you should probably put that code in a separate module and use
custom compiler option for that module, not apply the same limits to your
whole code base.

See comments in
https://github.com/erlang/otp/blob/maint/lib/compiler/src/cerl_inline.erl
for details. (It's a wonderful algorithm, if you're into that sort of
thing, but can take a while to get your head around. It's basically just
constant propagation and folding, treating functions like any other
constants, and handling local functions and funs in the same way. I'd
revisit it if I had the time.)

Note that if you use the option {inline,[{Name,Arity},...]} instead of just
'inline', then an older, simpler inliner is used, which _only_ inlines
those functions you listed, ignoring any size limits.

        /Richard

2016-11-12 6:56 GMT+01:00 Sergej Jurečko <>:

> On Nov 11, 2016 6:40 PM, "Tony Rogvall" <> wrote:
>
> > I used this ( WARNING! not to be used in production code yet, I guess? )
>
> Are these flags new?
>
> Sergej
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161112/47188275/attachment.html>


More information about the erlang-questions mailing list