[erlang-questions] receive _ -> ok end is exponential in queue length?!!

Matthew Sackman matthew@REDACTED
Fri Jul 10 16:57:59 CEST 2009


On Fri, Jul 10, 2009 at 04:41:29PM +0200, Richard Carlsson wrote:
> It seems that since the interpreter (erl_eval) must simulate the
> pattern matching over the mailbox, it must extract messages
> unconditionally from the head of the mailbox, one at a time,
> try to match them, and put them aside for later if they don't
> match.

Understood. Thank you and Ulf Wiger for the explanations. Interesting
how simulating Erlang in Erlang is so hard ;) I'm a little surprised
more helpful VM primitives haven't been built so that this step in the
shell evaluator can't utilise exactly the same functionality as post
compilation - i.e. removing the need to implement the evaluation of
receive through calling receive. It does somewhat limit the scalability
of the shell.

Matthew


More information about the erlang-questions mailing list