[erlang-questions] clarify: Sending big messages

Gleb Peregud gleber.p@REDACTED
Wed Oct 22 13:25:50 CEST 2008


Hi,

afaik, returning big terms will not degrade performance, since they
are not copied - it is just "returning by reference". It also applies
to big binaries. Correct me if I'm wrong.

Sending terms in a message involves copying, except for binaries
larger than 64bytes, which are referenced (and reference counted).
Hence you are absolutely right about rpc invoking.

BR,
Gleb

On 10/22/08, Zoltan Peter Toth <zoltan.peter.toth@REDACTED> wrote:
> Hi,
>
> We have a function like this:
>
> deliver(Port, Data) ->
>     Port ! {data, Data}.
>
> This function returns Data.
> Let's assume we want to send a big binary. If we call deliver(Port,
> BigBinary), is there any performance
> penalty that results from handling the return value (that equals
> BigBinary) ?
>
> Can it cause extra CPU/memory consumption later on e.g. during garbage
> collection ?
>
> I.e. is it worth changing deliver() to return just ok ?
> (This would be probably a good idea if this function is invoked via rpc.)
>
> Best regs,
>    /Zoltan
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>


-- 
Gleb Peregud
http://gleber.pl/

Every minute is to be grasped.
Time waits for nobody.
-- Inscription on a Zen Gong



More information about the erlang-questions mailing list