[erlang-questions] Retrieving "semi-constant" data from a function versus Mnesia

Jay Nelson jay@REDACTED
Thu May 14 00:58:29 CEST 2015


ROK wrote:

> One of them is or was erts_find_export_entry(module, function, arity),
> surprise surprise, which looks the triple up in a hash table, so it’s
> fairly clear where the time is going.

It’s funny because I recall from the CLOS "Art of the Metaobject Protocol”
that this was a high-speed solution to the method dispatch problem. The
memoization was bragging rights and what made it feasible.

> While I think this kind of call _could_ be faster, I suspect
> that they are fast _enough_ given their rarity and the other
> things going on in a program.

The OTP baseline is not reflective of application developers and their
expected frequent use of behaviours. These always use some form
of Module:function(…).  Or maybe the few places in the OTP baseline
are invoked frequently from a gen_* during normal operation (as you
said, there is a difference between static and dynamic analysis). But as
you also say, if it were really a _practical_ problem the complaints would
cause optimization patches.

jay




More information about the erlang-questions mailing list