[erlang-questions] performance vs msg queue length

Bernard Duggan bernie@REDACTED
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:

5.0
0.6
0.24
0.295
0.1545
0.1631
0.160826

Looks like pretty reasonable performance characteristics to me.

B


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 <per.melin@REDACTED> wrote:
>
>   
>> On Tue, Apr 20, 2010 at 8:41 PM, John Erickson <jderick@REDACTED> 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().
>>>> 1.0
>>>> 0.1
>>>> 0.06
>>>> 0.114
>>>> 0.1554
>>>> 0.36398
>>>> 0.358997
>>>>         
>> 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]].
>>
>> 1.0
>> 0.1
>> 0.06
>> 0.091
>> 0.1144
>> 0.11898
>> 0.120905
>>
>>     



More information about the erlang-questions mailing list