Datadog

How Go 1.24’s Swiss Tables saved us hundreds of gigabytes | Datadog

Jul 17, 2025Nayef Ghattas
How Go 1.24’s Swiss Tables saved us hundreds of gigabytes | Datadog
SummaryAI, from the source post

This post details how Go 1.24's new Swiss Tables implementation reduced memory usage in a large in-memory map, specifically the `shardRoutingCache` in the `ShardRouter` package. It shows how Datadog profiled and sized this change, observing a ~500 MiB reduction in live heap usage (leading to a ~1 GiB reduction with GOGC). The post also explains the memory layout of Go 1.23's bucket-based maps and contrasts it with the improvements brought by Swiss Tables, including how struct-level optimizations contributed to further savings.

More from the Go Map Memory Optimization trail