Question

I'm interested in the following:

  • How are Go maps implemented internally? (hash tables, trees...)
  • If Go maps are hash tables, which hash function is used?
  • If Go maps are trees, are they AVL, red-black, or some other type?
  • If Go maps are array-based, how do they avoid/handle collisions?
Était-ce utile?

La solution

Go maps are hash tables internally

As @twotwotwo clarified in the comment, Go will use an AES-based hash if the CPU has supporting instructions for it.

Otherwise Go will use a FNV hash function (As stated by Patrick Mylund Nielsen @ Go-Nuts)

Links:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top