[erlang-questions] Parallel Shootout & a style question
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Tue Sep 2 10:21:25 CEST 2008
Mats Cronqvist skrev:
> Gleb Peregud wrote:
>> Maybe it is good idea to include something like
>> http://code.google.com/p/plists/ into Erlang/OTP? It will probably
>> introduce more less tuned software created by developers, but it
>> will make programming multi-core systems much more easier and fun
>> for beginners.
>
> in an ideal world, all the basic OTP libs should be rewritten to be
> parallel. who gives an expletive if it's 10% slower on a single core
> machine?
Radical, but you have a point.
Before Robert reminds me, I might as well admit that I
scolded him severely for rewriting lists:map/2 as a
list comprehension, back in those days when LCs were
slower. Sorry Robert (but I was right ;-)
I am pretty sure that 10% means a lot to some people
out there.
However, if the library functions perform a lightweight
check and pick the parallel version only if SMP is enabled,
we're not talking 10%.
erlang:system_info(smp_support) -> boolean()
seems to hit the spot.
Perhaps an alias, like smp() -> boolean() could ease
the strain on our eyes and prevent carpal-tunnel
syndrome:
map(F, L) when smp() -> pmap(F, L);
map(F, L) ->
[F(X) || X <- L].
BR,
Ulf W
More information about the erlang-questions
mailing list