[erlang-questions] Updating Myths of Erlang Performance
Tuncer Ayaz
tuncer.ayaz@REDACTED
Wed Jun 8 10:49:46 CEST 2016
On 5 June 2016 at 07:46, Björn Gustavsson <bjorn@REDACTED> wrote:
> On Sat, Jun 4, 2016 at 10:33 PM, Tuncer Ayaz wrote:
> > On 4 June 2016 at 08:13, Björn Gustavsson wrote:
> >
> > > 2.1 Myth: Funs are Slow
> >
> > What exactly? Calling a fun (object) or creating one? Isn't the
> > time to construct fun objects considerable enough that one
> > shouldn't do it in, say, a loop?
>
> That was not the point with the myth at all, and I thinks that
> proves that it is time the myth is retired.
>
> Funs were really slow before R6B, at least an order of magnitude
> slower than today. The virtual machines (neither JAM nor BEAM) had
> any native support for funs. The function modules_lambdas() in each
> module had a clause for each fun defined in the module. The fun
> terms themselves were represented as 5-tuple. When a fun was called,
> the tuple had to be matched to extract the module that defined the
> fun, the arguments had to be packed into a tuple, and
> modules_lambdas() had to be applied. (Tony might remember more
> details about the implementation.)
Sorry, I should have pointed out that I was referring to the thread
from April 2015, not the myths.html calling-fun-is-slow myth.
http://erlang.org/pipermail/erlang-questions/2015-April/084363.html
So, what I should have asked: Should we add that, if one has to
optimize everything, avoiding construction of fun objects should be
considered as well? Like object instantiation in Java, there can be
times you want to optimize at that level, but in most code there's no
point.
More information about the erlang-questions
mailing list