Performance of term_to_binary vs Bbinary_to_term

Lukas Larsson garazdawi@REDACTED
Mon Jun 7 14:47:32 CEST 2021

On Mon, Jun 7, 2021 at 2:38 PM Thomas Depierre <depierre.thomas@REDACTED>

> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list