[erlang-questions] Difference between enif_schedule_dirty_nif and driver_async?

Robert Raschke rtrlists@REDACTED
Mon Jun 23 16:09:57 CEST 2014


Hi Max,

since you are already using separate nodes running NIFs, there's probably
not much worth in converting to a C node or port. So this is just for
posterity.

The inconvenience you appear to see in the C node setup is the same to that
of your setup. You have to have a way to start your transcoder server
(open_port & ei_connect & ei_xreceive_msg vs slave:start & load_nif &
ERL_NIF_INIT) and you have to translate/access the data from/in Erlang
to/from C (ei_x_decode_... vs enif_get_...). It's just that you've already
implemented your approach, and changing that would indeed be inconvenient.

The biggest architectural difference is that a C node or port must be based
around messaging, whereas a NIF is based on an API. The underlying
functionality is likely to be mostly identical.

And one scenario where a NIF is probably more convenient is if your C code
must operate in place on large binaries stored on the Erlang side. But by
using a separate node, I'm not entirely sure you get that benefit anyway.
Your data must find it's way to the transcoder node in any case.

Sorry I can't be of more assistance on the NIF vs async_driver question.

Regards,
Robby
 On Jun 22, 2014 5:24 PM, "Max Lapshin" <max.lapshin@REDACTED> wrote:

Dmitry, I'm using  slave:start for spawning separate Erlang process for
each transcoder and use nif (now with dirty schedulers) for running
decode/encode.

C port and c node are both very inconvenient, because they require lot of
marshalling/demarshalling.  Also it is impossible to run erlang between
different parts of C job.

_______________________________________________
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/20140623/d0e51523/attachment.htm>


More information about the erlang-questions mailing list