Re: Performance of term_to_binary vs Bbinary_to_term

Lukas Larsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAP3zBqPocyaZ9TAKawy-ZOcsUnV5RBAjtJYAfPUth143w_uY4g@mail.gmail.com>
On Mon, Jun 7, 2021 at 2:38 PM Thomas Depierre <[email protected]>
wrote:

> Yes there is a pretty simple answer :) Parsing is far harder than
> serialization ! for parsing, you have to read a bit of the binary stream,
> find what type it is, then translate the data to a data type, which means
> allocating memory. On top of that you need to validate that it is not a
> mangled binary stream. And you need to do it piecemeal, with a lot of
> information about current steps. This is far more complex than translating
> a particular memory setting that you know the size of into a binary stream.
>

Another thing that comes to mind is that the GC may be interfering with the
results as binary_to_term would create more garbage than term_to_binary.

Lukas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.