Port drivers vs nifs

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Port drivers vs nifs

Albin Stigö-2
Hi,

How does Nifs compare to Port drivers in OTP 21 and beyond..? It used to be that port drivers were more suited for threaded c libraries etc, but it seems to me now you can do anything with with either.

Will port drivers be deprecated? 

Which should I choose when starting a new hardware driver (assuming I have ruled out ports and c nodes, I'm aware of the implications)?


--Albin

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Port drivers vs nifs

Lukas Larsson-8


On Wed, Mar 20, 2019 at 9:22 AM Albin Stigö <[hidden email]> wrote:
Hi,

How does Nifs compare to Port drivers in OTP 21 and beyond..? It used to be that port drivers were more suited for threaded c libraries etc, but it seems to me now you can do anything with with either.

Will port drivers be deprecated? 

No. 
 

Which should I choose when starting a new hardware driver (assuming I have ruled out ports and c nodes, I'm aware of the implications)?

I would do it in a NIF. NIFs have a larger API, work on dirty schedulers and are in most cases more performant than port drivers.
 


--Albin
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Port drivers vs nifs

Albin Stigö-2
Thanks! The documentation should maybe be updated to reflect this... or maybe I just missed it.

On Wed, Mar 20, 2019, 10:52 Lukas Larsson <[hidden email]> wrote:


On Wed, Mar 20, 2019 at 9:22 AM Albin Stigö <[hidden email]> wrote:
Hi,

How does Nifs compare to Port drivers in OTP 21 and beyond..? It used to be that port drivers were more suited for threaded c libraries etc, but it seems to me now you can do anything with with either.

Will port drivers be deprecated? 

No. 
 

Which should I choose when starting a new hardware driver (assuming I have ruled out ports and c nodes, I'm aware of the implications)?

I would do it in a NIF. NIFs have a larger API, work on dirty schedulers and are in most cases more performant than port drivers.
 


--Albin
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions