Static vs. dynamic languages for AI coding: complex problems shrink efficiency differences
The article examines which programming languages are more efficient for AI agents and challenges the widely cited claim that dynamic languages are cheaper on tokens. The author's own evaluation on a more complex task (implementing a zstd decoder) shows that the difference between static and dynamic languages is not as dramatic and diminishes with increasing problem complexity, with language popularity weakly correlating with better results.
This is a big topic. We're approaching a time when we won't even read code anymore, so it'll matter less which language a given tool or application is written in. But it's good to at least roughly understand why an AI agent chose this particular language for this specific task. Who knows—maybe the time is coming when AI writes code directly at the hardware level.
Why are dynamic languages considered more efficient for LLM agents?
Dynamic languages do not require explicit type declarations, making code more compact and reducing the number of tokens needed to express the same logic. This hypothesis is supported by Martin's analysis and various benchmarks showing that dynamic languages can have 1/2 to 1/3 the token cost of static languages.
What problems do existing benchmarks have when comparing languages?
Existing benchmarks often use trivial tasks (such as Rosetta Code) where differences between languages are maximized. Their methodology also has flaws—for example, the second benchmark had incorrectly configured tests where one language agent overwrote paths of others, invalidating results for other languages.
What do the author's own experiments with a more complex task show?
When implementing a zstd decoder (a more complex problem), differences between static and dynamic languages blur. At higher effort levels, static languages sometimes lead, and overall there is a weak to moderate positive correlation between language popularity and quality of AI results.
- Understanding is the new bottleneck — geoffreylitt.com 76 % match
- LFM2.5-2.6B: small and capable local AI model — liquid.ai 75 % match
- AI agents develop roles and compete over code in coordination experiment — anthropic.com 75 % match
- zstd
- Clojure
- Rust3
- Go
- C++
- Python
- GPT-5.6 Sol8
- Dan Luu