[erlang-questions] Size of a map key in words

Michael Truog mjtruog@REDACTED
Fri Jun 30 04:59:05 CEST 2017


On 06/29/2017 06:13 PM, Richard A. O'Keefe wrote:
>> On 30/06/2017, at 12:23 PM, Michael Truog <mjtruog@REDACTED> wrote:
>>>
>> http://erlang.org/doc/efficiency_guide/advanced.html#id68923 has the memory information and https://github.com/okeuday/erlang_term shows how to get this size during runtime.
> Those two disagree.  For example, erlang_term says
> Small Map (N =< 32):
>    4 words + 2 words per key/value pair + the size of each pair
> whereas advanced.html says
> Small Map
>    5 words + the size of all keys and values.
>
> The latter just *has* to be wrong, the former is at least believable.
>
The erlang_term README information is based on an older version of the Erlang Efficiency guide html docs and the newer content is different.  It is possible an error was inserted into the new html docs, but it would be best for the Erlang/OTP team to check this.





More information about the erlang-questions mailing list