[erlang-questions] plists:foreach performances
Felix Gallo
felixgallo@REDACTED
Thu Mar 10 21:14:01 CET 2016
Yeah, that's because {processes, schedulers} limits the number of processes
to the number of schedulers as an optimization. Like all optimization,
tread carefully and know the implications before reaching for that first.
On Thu, Mar 10, 2016 at 11:33 AM, Caragea Silviu <silviu.cpp@REDACTED>
wrote:
> 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).
>
>
> (loadtest@REDACTED)1> load_test:tt2(130000).
> {15197488,done}
> (loadtest@REDACTED)2> load_test:tt2(130000).
> {15784610,done}
> (loadtest@REDACTED)3> load_test:tt2(130000).
> {17058412,done}
> (loadtest@REDACTED)4> load_test:tt(130000).
> {13020,ok}
> (loadtest@REDACTED)5> load_test:tt(130000).
> {10628,ok}
> (loadtest@REDACTED)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 <felixgallo@REDACTED> 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 <silviu.cpp@REDACTED>
>> 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 <
>>> andras.boroska@REDACTED> 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
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160310/0f436a7a/attachment.htm>
More information about the erlang-questions
mailing list