[erlang-questions] Re: Unicast 20k messages, $500-$1000 bounty

Paulo Sérgio Almeida psa@REDACTED
Thu Jul 16 16:44:32 CEST 2009


Witold Baryluk wrote:
> Dnia 2009-07-16, czw o godzinie 14:57 +0100, Paulo Sérgio Almeida pisze:
>> Hi Joel,
> 
>> - iterate the list in a tight loop as in:
>>
>>    send([], _M) -> ok;
>>    send([H|T], M) -> H ! M, send(T, M).
> 
> List comprehension can be faster:
> 
> send(L, M) ->
> 	[ H ! M || H <- L],
> 	ok.
> 

Or it can be slower. It varies. :)
They are basically the same if the comprehension optimizes away building 
a result list, as when using this "ok" here after it.

Paulo


More information about the erlang-questions mailing list