[erlang-questions] gen_server2 merge into OTP?

Matthew Sackman matthew@REDACTED
Sat Jul 18 16:56:51 CEST 2009


On Sat, Jul 18, 2009 at 03:13:44PM +0100, Matthew Sackman wrote:
> On Sat, Jul 18, 2009 at 03:53:52PM +0200, Ulf Wiger wrote:
> > "OTP-7979  gen_server:call/2,3 will be somewhat
> >     faster if the calling process has a many
> >     messages in its message queue."

It's in gen.erl, do_call/4 and wait_resp_mon/3, where if you diff, you'll
see the older versions have additional selective receives. So
previously, a call would result in 3 selective receives and now only 1.
OTOH, if you have a million messages in your mailbox, a factor of 3 is
pretty much irrelevant. Getting that mailbox empty is what's important,
which is why gen_server2 helps, because you are not scanning the
internal queue.

Matthew


More information about the erlang-questions mailing list