[erlang-questions] optimal way to append an element in a list inside a map
Richard A. O'Keefe
Wed Aug 30 02:18:55 CEST 2017
On 30/08/17 6:41 AM, Caragea Silviu wrote:
> Basically what you are saying is that any update over a map requires
> rebuilding of the entire map ?
It doesn't take much poking around on the Web before you discover
that Erlang maps use "a HAMT (Hash-Array Mapped Trie) internally once
the map grows enough. It is a clever data structure which combines the
properties of a hash table with a (level compressed) trie to provide
fast lookup as well as persistence. This is the same data structure
languages like Clojure, Scala and Haskell (unordered-containers) use.
They were designed by the now late Phil Bagwell and the Erlang variant
leans itself up against the work of Rich Hickey in Clojure."
-- Jesper L. Andersen, at
Large maps in Erlang are therefore trees with fairly wide nodes,
but updating a map WON'T copy the whole thing.
More information about the erlang-questions