[erlang-questions] Updating Myths of Erlang Performance
Björn Gustavsson
bjorn@REDACTED
Sun Jun 5 07:46:38 CEST 2016
On Sat, Jun 4, 2016 at 10:33 PM, Tuncer Ayaz <tuncer.ayaz@REDACTED> wrote:
> On 4 June 2016 at 08:13, Björn Gustavsson <bjorn@REDACTED> 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.)
/Björn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list