[erlang-questions] plists:foreach performances

Caragea Silviu <>
Thu Mar 10 20:33:50 CET 2016


Hello Felix,

The repo is : https://github.com/silviucpp/plists.git

I've tested your code and it's much slower than plists. In fact I
discovered that using {processes, schedulers} in plists speedup this a lot
and outperform everything.

tt(X)->
    Fun = fun(_X) ->
        ok
          end,

    List = lists:seq(1, X),
    timer:tc(fun()-> plists:foreach(Fun, List, {processes, schedulers}) end).

tt2(X) ->
    timer:tc(fun()-> lotsa:run(fun lotsa:sample_fun/1, X) end).


()1> load_test:tt2(130000).
{15197488,done}
()2> load_test:tt2(130000).
{15784610,done}
()3> load_test:tt2(130000).
{17058412,done}
()4> load_test:tt(130000).
{13020,ok}
()5> load_test:tt(130000).
{10628,ok}
()6> load_test:tt(130000).
{9918,ok}

If {processes, schedulers}is not used performance are like in your code.

Silviu


On Thu, Mar 10, 2016 at 8:13 PM, Felix Gallo <> wrote:

> not sure which plist you're using, but the one that I could find looked
> not entirely erlang-idiomatic; it tried to manage the process scheduling
> itself, perhaps as a test implementation of the way that other languages
> might do it.
>
> Here's how I might tackle that problem in pure erlang.
>
> https://gist.github.com/anonymous/94ace7cd94fd5930f3e4
>
> F.
>
> On Thu, Mar 10, 2016 at 8:45 AM, Caragea Silviu <>
> wrote:
>
>> No ,
>>
>> I have a function:
>>
>> tt(X)->
>>     Fun = fun(_X) ->
>>         ok
>>           end,
>>
>>     List = lists:seq(1, X),
>>     plists:foreach(Fun, List).
>>
>> and I'm calling this one : module:tt(130000).
>>
>> Silviu
>>
>>
>>
>> On Thu, Mar 10, 2016 at 6:43 PM, Boroska András <
>> > wrote:
>>
>>> Do you run this in the interactive shell? In that case put it in a
>>> module and compile it.
>>>
>>> Measuring anything in the shell is not relevant.
>>>
>>> Andras
>>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160310/05f1d6ff/attachment.html>


More information about the erlang-questions mailing list