[erlang-questions] Why erlang's computing performance is enormously less than c++

谈广云 fw339tgy@REDACTED
Fri Nov 11 08:26:30 CET 2016


i campare the erlang's computing with c++ 


erlang run 100000000 time the test_sum_0


test_sum_0(N) ->
  bp_eva_delta([1,2,3,4],[3,4,5,6],[]),
  test_sum_0(N-1).




bp_eva_delta([],_,L) ->
lists:reverse(L);
bp_eva_delta([O|Output],[S|Sigma],L) ->
bp_eva_delta(Output,Sigma,[S * O * (1-O) |L]).








c++ run the same time (100000000 ) the similar fun ,


for(int i = 0 ;i< 100000000;++i)
{
double b[5] = {1,2,3,4,5};
double s[5] = {6,7,8,9,10};
double o[5];
for(int i = 0; i < 5;++i)
{
o[i] = s[i] * b[i] * (1 - b[i]);
}


}.


the erlang spend 29's , and c++ spend 2.78's.


why the erlang is so slower than c++?


 Or I do not configure  the right parameter?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161111/5e9154c2/attachment.htm>


More information about the erlang-questions mailing list