[erlang-questions] Efficiency of splitting binaries

Håkan Stenholm <>
Thu Oct 25 01:16:38 CEST 2007


Richard Andrews wrote:
>>> I currently use iolist_size() to check the size of the input binary then
>>> recursively break off a chunk from the front with something like, eg.
>>>
>>>       
>> Why are you using iolist_size()? Is it possiblethat your input is not a 
>> binary?
>>     
>
> What other way is there to determine the length of a binary?
>   
size/1 (works on binaries and tuples), while length/1 works on lists e.g.:

 > size(<<>>).
0
 > size(<<"abcde">>).
5
 > size({}).
0
 > size({1,2,3}).
3

>
>
>       Sick of deleting your inbox? Yahoo!7 Mail has free unlimited storage.
> http://au.docs.yahoo.com/mail/unlimitedstorage.html
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>   



More information about the erlang-questions mailing list