[erlang-questions] performance on multicore computer

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Sun Oct 24 22:13:48 CEST 2010


On Sun, Oct 24, 2010 at 7:48 PM, Jiansen He <jiansenhe@REDACTED> wrote:

[..]

> %% -- generate all sequences of length at most n
> %% gen :: Int -> [String] -> AssocList [String] Int
> gen(0, _) ->
>     [];
> gen(N, L) ->
>     [Sqs_len_n, Sqs_up_to_n1] = rpc:parallel_eval([concordance_1_1_2, gen_,
> [0, N, L], concordance_1_1_2, gen, [(N-1), L]]),
>     io:format("~p",[Sqs_len_n]).
>
>
> However, when I run this code, I got following error message:

The problem is that rpc:parallel_eval/1 takes values in another form. It expects

rpc:parallel_eval([{M, F1, Args1}, {M, F2, Args2}])

in your case, but you omit the tupling { and } in your call. Hence
what you are seeing is a runtime error on it. Here is a quick test,
like yours:

Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:2:2] [rq:2]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.2  (abort with ^G)

1> rpc:parallel_eval([{dict, new, []}]).
[{dict,0,16,16,8,80,48,
       {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
       {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}]

I am somewhat interested if the code will be fastest in Erlang or
Haskell. I am guessing Haskell, but do beware laziness and profile the
Haskell code a bit. It tends to bite :)

-- 
J.


More information about the erlang-questions mailing list