[erlang-questions] Best Practice in Map keys: Atoms or Binaries (or Strings)?

Björn-Egil Dahlberg XB bjorn-egil.xb.dahlberg@REDACTED
Mon Oct 3 11:19:55 CEST 2016


On 10/03/2016 11:12 AM, Björn-Egil Dahlberg XB wrote:
> On 10/03/2016 11:06 AM, José Valim wrote:
>>
>>     Also, for literal keys the hashing is done at *load time* so it
>>     will only hash again when it that hash exhausted, typically this
>>     will happen if Maps are larger then 50000 pairs.
>>
>>
>> Neat. Does this happen only on maps creation or also when updating 
>> maps with := or =>? What about matching on maps?
>
> Any get_map_element(s) so matching and lookups with literals for sure. 
> We haven't done it for updating or creation but lookups are far more 
> common. Also, not for BIFs.

And ofc, if everything are literals at compile time the map is 
constructed at compile time, not load time or run time.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161003/f8543d80/attachment.htm>


More information about the erlang-questions mailing list