What happens if you keep asking AI to rewrite it to use less and less resources?
It’s actually pretty good at this if you have some very specific constraints and objective.
tbh, it probably works. I'm vibe-coding a thing and just told it to figure out why it runs so slow: put in some optimizations. It ran some tests and stopped loading an entire-something at opening because there's no value to doing that.
It does a pretty good job being put into a loop of "try to optimize for X" then "test and audit your code" then repeat.
This: https://news.ycombinator.com/item?id=49226923