I spent an hour trying to improve a function in my Rust program. Unfortunately, after all my work, it turned out my changes made it slower, so I had to discard the new version. In dismay, I loaded a local LLM in OpenCode (Qwen 3.6 35B with AutoRound) and asked it for some tips.
It came up with an idea I had not considered—split the function in two parts and remove a bunch of if
-statements. I had the LLM agent implement the code, and after benchmarking, I found the new version was faster. I spent some time tidying things up, and now the program is faster and clearer than before.
Interestingly, it seems that:
• My own coding failed as I tended to be reluctant to give up on a failed approach I had invested time in.
• The LLM came up with a completely different idea and implemented it.
• In this particular case, the LLM agent seems to have outperformed me.
I don't think this is proof that the LLM is a better programmer than I am. It does seem to indicate I tend to get stuck on trying to force a bad solution to work. Having a different approach altogether worked better in this case.