[erlang-questions] sharing a binary when decoding?

Jesper Louis Andersen <>
Fri Feb 3 15:20:02 CET 2012


On 2/3/12 2:12 PM, Anthony Shipman wrote:
> What I have in mind will have large binaries that are decoded from 
> socket data. I was hoping that this wouldn't duplicate the data. 
The binary might be compressed and in that case it is not possible to 
use the sub-binary representation. In other words, you are not 
guaranteed that it uses sub-binaries, but an implementation may choose 
to do so in some cases.

My recommendation would be to decode once and then go with that. 
Decoding is usually extremely fast.

-- 
Jesper Louis Andersen
   Erlang Solutions Ltd., Copenhagen, DK




More information about the erlang-questions mailing list