<div dir="ltr">I'm not sure if it is good idea at all. If F function is very cheap and result or parameter is large (copy of it is more expensive in comparison to F expense) parallel version of pmap can be slower than serial version even many cores is used. Developer should be able control size of parallelized bunch and switch off parallel process fully. For example pmap(fun(X) -> [0|X] end, [lists:seq(1,1000000)]) is really bad idea and I will not be happy if lists:map will be changed to pmap automatically at default ;-)<br>
<br><div class="gmail_quote">On Tue, Sep 2, 2008 at 10:21 AM, Ulf Wiger (TN/EAB) <span dir="ltr"><<a href="mailto:ulf.wiger@ericsson.com">ulf.wiger@ericsson.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mats Cronqvist skrev:<br>
<div class="Ih2E3d">> Gleb Peregud wrote:<br>
>> Maybe it is good idea to include something like<br>
>> <a href="http://code.google.com/p/plists/" target="_blank">http://code.google.com/p/plists/</a> into Erlang/OTP? It will probably<br>
>> introduce more less tuned software created by developers, but it<br>
>> will make programming multi-core systems much more easier and fun<br>
>> for beginners.<br>
 ><br>
> in an ideal world, all the basic OTP libs should be rewritten to be<br>
> parallel. who gives an expletive if it's 10% slower on a single core<br>
>  machine?<br>
<br>
</div>Radical, but you have a point.<br>
<br>
Before Robert reminds me, I might as well admit that I<br>
scolded him severely for rewriting lists:map/2 as a<br>
list comprehension, back in those days when LCs were<br>
slower. Sorry Robert (but I was right ;-)<br>
<br>
I am pretty sure that 10% means a lot to some people<br>
out there.<br>
<br>
However, if the library functions perform a lightweight<br>
check and pick the parallel version only if SMP is enabled,<br>
we're not talking 10%.<br>
<br>
erlang:system_info(smp_support) -> boolean()<br>
<br>
seems to hit the spot.<br>
<br>
Perhaps an alias, like smp() -> boolean() could ease<br>
the strain on our eyes and prevent carpal-tunnel<br>
syndrome:<br>
<br>
map(F, L) when smp() -> pmap(F, L);<br>
map(F, L) -><br>
   [F(X) || X <- L].<br>
<br>
<br>
BR,<br>
Ulf W<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br>
</div>