[erlang-questions] Binary matching implementation / performance

Christopher Baus <>
Sat Jul 14 00:43:49 CEST 2007


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


<<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.



More information about the erlang-questions mailing list