[erlang-questions] term_to_binary and record improvements

Christian chsu79@REDACTED
Fri Aug 29 11:22:09 CEST 2008

>> Question:  in existing Erlang use, which is more important,
>> speed of generating a binary encoding for a term, or how big
>> it is (which relates to how quickly it can be sent across a
>> network and how fast it can be decoded, amongst other things).
> I'm think we can make it smaller and faster ...

And if it is not possible to get both, there is the
erlang:term_to_binary/2 where an option could be provided to be
explicit on how powerful sharing-detection one wants (as per the list
Richard A. O'Keefe provided for example).

Maximal sharing detection could be useful for dets-tables where the
explosion also matters, and where maximal detection still takes much
less time than the actual writing to disk.  (another semi-related
issue is to optimize the size of atoms occuring in several places in
the same dets file)

Personally I'm having trouble seeing how one can get smaller AND
faster term_to_binary, but i see how a smaller result from it could
make binary_to_term faster (and needing to allocate less). That is,
faster binary_to_term at the cost of slower term_to_binary.

More information about the erlang-questions mailing list