[erlang-questions] Binary matching implementation / performance

Christopher Baus christopher@REDACTED
Sat Jul 14 00:43:49 CEST 2007


Hi,

I'm learning erlang, and I have a question regarding binary matching
performance and implementation.

Consider:

<<X,Rest/binary>> = <<"somebinarydata">>.

Are X and Rest constructed by copying and reallocating the underlying
buffer (I suspect they are), or do the new variables just contain pointers
to the original data?

If rest is sufficiently long, reallocating could be very slow and would
probably require converting the binary to a list.

Thanks,

Chris





More information about the erlang-questions mailing list