Hash tables in Go and advantage of self-hosted compilers
Go's hash map implementation changed in version 1.24 with Swiss Tables, affecting a common memory optimization trick. Previously, using `map[int]struct{}` instead of `map[int]bool` saved memory because empty structs occupied zero bytes and the compiler omitted the values array. However, the new implementation stores key-value pairs differently, requiring padding for memory alignment that makes both approaches consume the same memory (8 bytes per slot). The article demonstrates how self-hosted compilers make it easier to debug such issues by examining the source code directly.