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

Richard Carlsson carlsson.richard@REDACTED
Fri Nov 11 11:13:09 CET 2016


You are comparing a native-compiled C++ program that works on small arrays
of raw numbers with an interpreted Erlang program that traverses linked
lists of tagged numbers. The only surprise is that the difference is _only_
a factor 10. (And if the C code was using integers instead of double
precision floats, it would be even faster.)


        /Richard

2016-11-11 8:26 GMT+01:00 谈广云 <fw339tgy@REDACTED>:

> 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/cb476bef/attachment.htm>


More information about the erlang-questions mailing list