[erlang-questions] performance vs msg queue length

Ulf Wiger <>
Tue Apr 20 16:27:54 CEST 2010


David Mercer wrote:
> Does that handle all the OTP selective receives (e.g., gen_server, mnesia,
> etc.)?  That is, do all OTP selective receives follow a call to
> erlang:monitor/2 and then receive matching on MRef in the same function?
> 
> Am thinking that, if so, the rule could be made implicit regarding selective
> receives following erlang:monitor's in the same function.  Otherwise, a more
> explicit approach might be necessary.  Some sort of mark_queue function,
> which returns a reference which can then be inserted into a receive call --
> something like:
> 
> 	Qmark = erlang:mark_queue(),
> 	receive from Qmark
> 		. . .


One of the things being debated is how much rope should be given
to the programmers, that they may hang themselves with. One great
advantage of having the compiler do it internally is that it
would only do so if in cases where it is absolutely safe to do
so.

I think the pattern would work in most, but not necessarily all,
of the places where selective receive is required. For the
remaining cases, I'm not convinced - off the top of my head -
that an explicit mark_queue() function would help either
(but that's from spending 10 seconds thinking about it, so I
may well be wrong.)

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list