[erlang-questions] generators/iterators

Darius Bacon <>
Mon Jun 18 08:14:28 CEST 2007


Damien Morton <> wrote:
> Im new to Erlang - so its just that - a guess. But ... when I imagine 
> what the machinery for a message send is, compared to what I know the 
> machinery for a function call is, at last in broad strokes, if a fun 
> call isnt faster, it should be.

On my iBook, a round-trip of a small message and reply takes about 2.5
microseconds. A corresponding local call takes about 0.33, in
BEAM. (HiPE is faster.)

I made these measurements while trying out Mark S. Miller's idea of
hiding your PID from another process you want to communicate with,
using a one-shot cut-out process you share a private ref with -- a new
one for every call. That turned out to cost only 8.5 microseconds. If
you have a scheme that seems wildly extravagant of processes and
messages, well, Erlang might surprise you.

(Of course, in the language as it is you can't really protect your PID
-- someone can just call processes().)

Darius



More information about the erlang-questions mailing list