[erlang-questions] Sending term vs binary
Tue Feb 28 15:12:33 CET 2012
It would always* be greater as when doing binary_to_term and
term_to_binary everything is copied to a special heap. So instead of
doing a simple copy from one heap to another, you would do an encode
via copy to binary heap, send reference, decode via copy from binary
There might be something to gain if you are going to send the huge
term in between a chain of processes without decoding it, but that
seems like an unlikely scenario.
* Note that I haven't done any measurements on this, it is based
purely on what I remember beam works.
On Tue, Feb 28, 2012 at 2:19 PM, Ignas Vyšniauskas <> wrote:
> Has anyone done any benchmarking regarding sending big messages as terms
> ("as is") vs binary, i.e.
> time required to send pure term
> total time for doing term_to_binary/1 + sending binary + binary_to_term/1
> Obviously the context here is a single VM with big messages (say >500KB)
> such that only references of binaries are sent and we could actually
> expect some significant differences.
> I'd would be also interesting to hear any other comments regarding such
> potential optimisation.
> erlang-questions mailing list
More information about the erlang-questions