I know that for a list, we need to go through the entire list and then determine its size?
What is the difficulty in determining the size of a binary file in Erlang?
byte_size (command to measure a binary file) runs in constant time, not related to the size of the binary file, and the length of the list is proportional to the size of the list.
Link
Time and complexity of the memory erlang:size/1 , erlang:tuple_size/1 , erlang:bit_size/1 and erlang:byte_size/1 equal to O (1). (And erlang:map_size/1 .) Why do you even think it might be something else? It doesn't make any sense.
erlang:size/1
erlang:tuple_size/1
erlang:bit_size/1
erlang:byte_size/1
erlang:map_size/1