NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
How Swiss tables work in Go built-in map (victoriametrics.com)
nasso_dev 11 hours ago [-]
swiss tables were invented by engineers working at google's zurich office, hence the name

im surprised that go, a programming language also from google, wasn't using them!

for an excellent talk on the development of swiss tables i highly recommend this talk by Matt Kulukundis at CppCon 2017: "Designing a fast, efficient, cache-friendly hash table, step by step" https://youtu.be/ncHmEUmJZf4

hazz 2 hours ago [-]
The Rust std lib HashMap is powered by the hashbrown crate which is also a port of Swiss Tables. At a brief glance Ruby/Python don’t use this approach but I don’t see any reason why they couldn’t.
EdSchouten 6 hours ago [-]
I guess it took a bit longer to get it adopted within Go because of some additional challenges:

https://go.dev/blog/swisstable#go-challenges

tialaramex 10 hours ago [-]
Go is much older than Swiss Tables. Since the hash table is a widely used container type and Go aspires to having a sort of "kitchen sink" stdlib I assume Go 1.0 had a hash table, and it can't be a Swiss Table because those weren't invented yet.
jerf 10 hours ago [-]
It's the "map" builtin. Go has a scripting-language-esque attitude of "you can build most things with arrays and hash tables". It doesn't completely preclude getting deeper but that's the general starting point.
donk8r 2 hours ago [-]
[dead]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 10:18:17 GMT+0000 (Coordinated Universal Time) with Vercel.