Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complexity to determine the size of an Erlang's binary

I know that, for a list, we have to traverse the entire list and then determine the size of it?

What is the complexity to determine the size of a binary in Erlang?

like image 908
sad Avatar asked Feb 05 '23 10:02

sad


1 Answers

byte_size/1 (the command to measure binary stuff) executes in constant time irrelevant to the size of the binary, while length of a list is proportional to the size of the list.

See 3 Common Caveats for reference

like image 120
Aus Avatar answered Feb 09 '23 01:02

Aus