96k Cards, One Copy of Each String: String Interning in the Rust Engine
·7 mins
The Rust card store held 96k printings, each owning its own heap-allocated strings — even though ‘Forest’ appears 130 times with the same set name and ‘Shock’ has the same oracle text across every printing. Replacing each unique string with a u32 ID cut the archived card data from 107 MB to 47 MB and the build-time heap from 205 MB to 145 MB.