I decided to use frontier models to generate a trie in Rust. The existing, hand-written version of the code used about 391 KiB of RAM on each thread, and most of this was wasted space. So I wrote up a spec file and had Gemini 4 Neon, Claude Opus 5.5, and GPT 6.2 Sol generate the required Rust struct.
I started with GPT 6.2 Sol. This was the cheapest model, at $0.03, and the trie required 33 KiB of memory and caused a significant regression in runtime performance—from 21.5 seconds to 23.5 seconds. The code worked correctly and fit my requirements.
Next, with Claude Opus 5.5, I spent $0.23. The Rust struct took 64 KiB of memory and was much faster than Sol's version at 21.82 seconds.
Finally, with Gemini 4 Neon, the cost was $0.27 (the most expensive) and the resulting memory usage was 23 KiB, the smallest of the 3 versions. Neon's code was also fast like Opus's at 21.86 seconds. So given my requirements, the trie went from requiring about 391 KiB memory to 23 KiB memory, with a fairly small performance loss. I decided Gemini Neon's version was the best, although Claude Opus's was slightly faster but used twice as much memory. My hand-written version was faster than all of them, but it was a memory waster and the LLMs brought memory down by about 95%.