[erlang-questions] performance vs msg queue length
Wed Apr 21 00:53:55 CEST 2010
Actually I'd be kind of inclined to put it down to experimental error,
minor internal implementation and system details (size of memory blocks
being allocated, use of processor cache and so on) and perhaps other
stuff going on in the system. Because my results were:
Looks like pretty reasonable performance characteristics to me.
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? It seems to imply we should try to keep message queues under 100
> messages. I also wonder how message size plays into this.
> On Tue, Apr 20, 2010 at 12:15 PM, Per Melin <> wrote:
>> On Tue, Apr 20, 2010 at 8:41 PM, John Erickson <> wrote:
>>> [begin [ self() ! a || _ <- lists:seq(1,N) ],
>>>> S = now(),
>>>> [ receive _ -> ok end || _ <- lists:seq(1,N) ],
>>>> io:format("~w~n", [timer:now_diff(now(), S) / N])
>>>> end || N <- [1,10,100,1000,10000]].
>>>> If I put it into a module, add 1e5 and 1e6 then I get:
>>>> 1> test:test().
>> One little change:
>> [begin L = lists:seq(1,N),
>> [ self() ! a || _ <- L ],
>> S = now(),
>> [ receive _ -> ok end || _ <- L ],
>> io:format("~w~n", [timer:now_diff(now(), S) / N])
>> end || N <- [1,10,100,1000,10000,100000,1000000]].
More information about the erlang-questions