[erlang-questions] performance vs msg queue length
Wed Apr 21 00:42:54 CEST 2010
On Tue, Apr 20, 2010 at 03:25:44PM -0700, John Erickson wrote:
> These results are clearly better, but still I'm a bit surprised there is a
> noticable slowdown, especially from 100-10k. Does anyone know the reason
> for this?
I don't *know*, but my guesses are:
1. The VM deschedules processes sending messages to processes with full
mailboxes. I don't know if this extends to a process sending a message
to itself - I would hope it didn't extend to that, but then again,
sending messages to yourself is a reasonably rare thing to do, so it's
possible they've not bothered optimising that case.
2. Allocation of a bigger mailbox. I would expect that it would probably
be a standard "everytime we run out of space, double the size of the
mailbox", but there are probably a few sensible policies for this.
malloc won't be free.
3. You are constructing ever longer lists of 'ok' atoms. Doing a
recursive loop with counter would avoid this, and so you would get down
to timings of doing the actual receives.
This list is probably in reverse order of liklihood.
More information about the erlang-questions