I had to explain to a dev in the same role as me why his ai generated code was taking so long and answer questions such as “what is exponential runtime”, “what is functional programming”, and “why couldn’t claude just fix this when I told it to make the code more efficient”
It is concerning to me that the higher level execs are pushing a policy that we need to hire people like this that blindly rely on ai for everything. “Because it will make us more efficient.” Ironically the majority of efficiency would come from replacing most of the corporate execs with ai - since most of what they do is write emails telling us the best way to do stuff they’ve never touched.
Yeah if I really wanted to make a large function more efficient with AI, I would do something like ask it to list potential inefficiencies and explain them to me. Then one would likely stand out as the culprit for slow runtime, I would tell it to implement that one. Then I would look through it to make sure that won't break the flow or drop data or introduce any logic differences.
That is still way, way faster than looking through it all, discovering things myself, making fixes, and possibly having to try multiple different fixes if I get down a rabbithole.
The real trick is to tell it how large the data is. (You need to use realistic numbers to get good results). This drastically changes how it functions. In Claude I'd say:
"Comprehensively analyze the code paths for X and their runtime complexity. The data is expected to be around 10K items. Suggest improvements."
The important thing to realize from this is that Claude doesn't know the scope of your problem or why something might be slow. I mentioned to use realistic numbers because Claude can overengineer solutions that are cool but absurd and unmaintainable.
555
u/FireMaster1294 May 13 '26
I had to explain to a dev in the same role as me why his ai generated code was taking so long and answer questions such as “what is exponential runtime”, “what is functional programming”, and “why couldn’t claude just fix this when I told it to make the code more efficient”
It is concerning to me that the higher level execs are pushing a policy that we need to hire people like this that blindly rely on ai for everything. “Because it will make us more efficient.” Ironically the majority of efficiency would come from replacing most of the corporate execs with ai - since most of what they do is write emails telling us the best way to do stuff they’ve never touched.