[erlang-questions] Do you wanna play with enif_select?

Sverker Eriksson <>
Fri Dec 2 20:29:54 CET 2016



On 12/02/2016 06:30 PM, Max Lapshin wrote:
>> almost twice the throughput if I remember correctly.
> you mean that new implementation outperforms driver?  Driver is calling C
> callback without scheduling to erlang and enif is sending message and it
> takes less CPU cycles?
>

Well, ports are actually scheduled to execute the C callbacks.

But I don't think that matters in my benchmark runs, because the number
of calls to enif_select and messages sent are tiny compared to
the number of successful read/write calls.

So "twice the throughput" is probably more an effect of NIF call overhead
vs port call overhead plus the efficiency of my toy client NIF code
vs gen_tcp down to inet_drv.c with all their features.


/Sverker




More information about the erlang-questions mailing list