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

Vans S vans_163@REDACTED
Fri Nov 11 16:16:27 CET 2016


Please write C nif containing function:

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]); }
 }.

change erlang code to:

test_sum_0(N) ->
  call_c_nif(N);
Try test again.
 

    On Friday, November 11, 2016 5:01 AM, 谈广云 <fw339tgy@REDACTED> wrote:
 

 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?



 
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions


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


More information about the erlang-questions mailing list