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.
Swapping cachetools for cachebox (a Rust-backed Python cache) required only a thin key-hashing compatibility wrapper. TTLCache operations went from 537 ns/op to 90 ns/op — a 6× gain for a one-line dependency change.
Why id:gruul was doing a full table scan and how encoding color identity as a 5-bit integer—twice, once in SQL and once in the Rust engine—fixed it with arithmetic that fits in a single CPU instruction.
Card search moved from PostgreSQL into a Rust extension via PyO3. The 76× speedup came not from clever SQL tuning but from eliminating the database round-trip entirely — and from hitting a ceiling that Python itself could not clear.
When you type t:cre, the search box completes it to t:Creature before any network request leaves your browser. The type list lives in a frozen in-memory index, populated once at page load from the Rust engine.