I find AI generated code to be more efficient overall, mostly because it doesn’t have the readability requirements as human code. Also, traditionally “easy” human programming languages perform very poorly with LLMs.
I write a lot of PHP (I know). PHP is not only slow, it’s awful for LLMs because it’s so dynamic. It’s difficult to statically analyze. So, there’s basically no reason to program in PHP outside of “we already have code in PHP”. It performs worse, and it’s harder to write and verify.
But, AI generated PHP code gives a lot more weight to types. So, it ends up being easier to read and more performant than human written code typically.
This is still a step up from JS, which is even more dynamic and wishy-washy than PHP. But, the best languages for LLMs have strict, high-quality, and expansive tool chains. Like dotnet, Java, and rust. These languages are also much higher performance than “ergonomic” languages like PHP, ruby, python, JS. So, we will see more of them over the coming years I think.
I am working on a C++ codebase that has some serious performance requirements and I need to regularly stop mistakes that would lead to pretty big performance regressions. Just yesterday I had a performance improvement session that wouldn't have gone anywhere if I hadn't pushed back hard against a few bad decisions that would have quartered the performance of a key algorithm (measured in benchmarks in the end). I've had several instances where bad memory mamagement practices slowed down inner loops by up to a factor of two in benchmarks while the agent would initially insist that the change would be a speedup. Memory usage would also have increased along the way.
It is quite interesting to see the normally quite accurate Claude models start to fumble like that. It has an obvious correlation with the amount of open source code out there that solves a particular problem.
LLMs really don't have a sense of time — and it shows.
If you have a test suite that runs in ~0.1s, they'll happily add a test that exercises some timeout or other that just sleeps for 3s for no apparent reason. Humans would immediately notice that `make test` used to return instantly and is now slow. LLMs don't care.
If you're working with coding agents, you need guardrails against that sort of thing.
I suspect the same is true of UI code. Computer use is slow and relies on freze frames, so a glitchy animation or a spinner suddenly taking half a second instead of 0.1s isn't something they're going to notice, especially because they don't even have baselines.
[I always assumed that pixelflut is an intentionally wasteful protocol, as a kind of artistic statement.]
Replies (1)
I write a lot of PHP (I know). PHP is not only slow, it’s awful for LLMs because it’s so dynamic. It’s difficult to statically analyze. So, there’s basically no reason to program in PHP outside of “we already have code in PHP”. It performs worse, and it’s harder to write and verify.
But, AI generated PHP code gives a lot more weight to types. So, it ends up being easier to read and more performant than human written code typically.
This is still a step up from JS, which is even more dynamic and wishy-washy than PHP. But, the best languages for LLMs have strict, high-quality, and expansive tool chains. Like dotnet, Java, and rust. These languages are also much higher performance than “ergonomic” languages like PHP, ruby, python, JS. So, we will see more of them over the coming years I think.
Replies (1)
I am working on a C++ codebase that has some serious performance requirements and I need to regularly stop mistakes that would lead to pretty big performance regressions. Just yesterday I had a performance improvement session that wouldn't have gone anywhere if I hadn't pushed back hard against a few bad decisions that would have quartered the performance of a key algorithm (measured in benchmarks in the end). I've had several instances where bad memory mamagement practices slowed down inner loops by up to a factor of two in benchmarks while the agent would initially insist that the change would be a speedup. Memory usage would also have increased along the way.
It is quite interesting to see the normally quite accurate Claude models start to fumble like that. It has an obvious correlation with the amount of open source code out there that solves a particular problem.
Replies (1)
If you have a test suite that runs in ~0.1s, they'll happily add a test that exercises some timeout or other that just sleeps for 3s for no apparent reason. Humans would immediately notice that `make test` used to return instantly and is now slow. LLMs don't care.
If you're working with coding agents, you need guardrails against that sort of thing.
I suspect the same is true of UI code. Computer use is slow and relies on freze frames, so a glitchy animation or a spinner suddenly taking half a second instead of 0.1s isn't something they're going to notice, especially because they don't even have baselines.