[erlang-questions] matching binary against a file

Mike McNally m5@REDACTED
Sat Jun 23 14:40:49 CEST 2007


> Basically, a binary is implemented as a couple of
> pointers into a byte array. So extracting Remainder
> will allocate a new box of pointers, but will not copy
> the underlying byte array. (Since the binary is
> immutable, the array can be safely shared.)

OK, good - that is what I had assumed to be true.

> On the other hand, building a new binary <<A,B>> is
> implemented by copying the underlying byte arrays. In
> principle, it could be done with a different trade off
> by adding a "tree binary", but in that case, indexing
> into the binary gets messy ... Also, a "tree binary"
> is easily emulated by hand. I assume the current
> approach was the one that's worked out best.

Yes, thanks, again that is as I had surmised. And I agree that
the behavior of the runtime should not be too explicitly stipulated.
I try to simplify my inuitive feeling for operations as being
"easy to do" or "hard to do" and leave it at that.

--
[ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED



More information about the erlang-questions mailing list