Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang - C and Erlang

Tags:

c++

c

erlang

There are certain common library functions in erlang that are much slower than their c equivalent.

Is it possible to have c code do the binary parsing and number crunching, and have erlang spawn processes to run the c code?

like image 719
BAR Avatar asked Aug 21 '10 05:08

BAR


1 Answers

Of course C would be faster, in the extreme case, after optimizations. If by faster you mean faster to run.

Erlang would be by far, faster to write. Depending on the speed requirements you have Erlang is probably "fast enough", and it will save you days of searching for bugs in C.

C code will only be faster after optimizations. If you spend the same amount of time on C and Erlang you will come out with about the same speed (note that I count time spent debugging and error fixing in this time estimation. Which will be a lot less in Erlang).

So:

faster writing = Erlang
faster running (after optimisations) = C
faster running without optimisations = any of the two

Take your pick.

like image 124
Daniel Luna Avatar answered Sep 20 '22 03:09

Daniel Luna