Is it preferable to expose the C library in Elixir / Erlang or implement it in Erlang / Elixir?

My background is in Perl / Python / node and a small amount of Ruby. I have not used the BEAM VM languages ​​before.

In Perl / Python / Node / Ruby, if I wanted to cope with the tasks of the "lower level" - intensive computing, requiring access to threads or, most often, wrapping the C library - I would write something in C. Elixir / Erlang obviously has great parallelism in the form of Erlang processes and very low latency, eliminating much of this need.

So, if I had a C library, would it be preferable to make an Elixir / Erlang shell or just override the functionality?

A very concrete example: does Elixir / Erlang use TLS OpenSSL or is it implemented in BEAM?

+3
source share
1 answer

The usual way to implement things in Erlang is to first implement it in Erlang and then measure it. If it does not work well, first find improvements in Erlang. If it's not good enough yet, rewrite the hot parts in C. You can use ports as a more secure way or NIF, . , ( ) , . . Erlang . , Erlang/Elixir, .

, Erlang, Erlang .

, TLS Erlang ( , IO,...) C (- ).

: , . , Erlang, ++. . Cpp Erlang Motorola Telecoms.

+9

Source: https://habr.com/ru/post/1607102/


All Articles