[erlang-questions] why is gen_tcp:send slow?

Adam Kelly cthulahoops@REDACTED
Fri Jun 20 12:04:13 CEST 2008


2008/6/19 Rapsey <rapsey@REDACTED>:
> The transmit could of course be written with a passive receive, but the code
> would be significantly uglier. I'm sure someone here knows if setting
> {active, once} every packet is CPU intensive or not.

Is the streaming process building up a message queue (a back log of
messages waiting
to be sent?).  gen_tcp:send does a selective receive in order to
acknowledge that the
packet has been sent, so if the process has a message queue it has to
do a linear search
of the message queue on each send and the streaming becomes O(N^2).

Adam.



More information about the erlang-questions mailing list