[erlang-questions] wise binary tails?

Torben Hoffmann torben.lehoff@REDACTED
Sat May 15 22:38:32 CEST 2010


I think you should read
http://erlang.org/doc/efficiency_guide/binaryhandling.html and try to see if
it can explain your question - it seems that your code is what is the most
optimal, but I would recommend reading it rather than trusting my quick gaze
over the documentation.

Cheers,
Torben

On Wed, May 12, 2010 at 19:56, Henning Diedrich <hd2010@REDACTED> wrote:

> If I have code like this:
>
> traverse(<<Bar:24, Rest>>) ->    [  Bar |  traverse(Rest) ];
>
> traverse(<<>>) -> [].
>
> traverse(FooBin).
>
> - or -
>
> [ Bar || <<Bar:24>> <= FooBin ].
>
> is Erlang internally doing the wise thing of simply shifting a pointer into
> the low level buffer where FooBin is stored.
>
> And thus avoids copying the rest of the buffer again and again?
>
> Thanks!
> Henning
>



-- 
http://www.linkedin.com/in/torbenhoffmann


More information about the erlang-questions mailing list