Shrinking Ruby Hashes
Summary
This post analyzes Ruby Hash memory usage, tracing the history of Hash internals from early Ruby versions to modern changes like open addressing, array tables, and the lower-byte hashcode optimization. It covers immutability and frozen hashes, Variable Width Allocation (VWA), and discusses trade-offs and potential gains for memory-constrained Ruby apps. It also discusses practical guidance for reducing Hash memory usage, and cites patches and benchmarks along the way.