The 'Dynamic Languages Are More Token-Efficient' Claim Falls Apart Under Real-World Tests
What's the best programming language for coding agents?
A widely cited eval claims dynamic languages like Clojure are far more token-efficient for LLM coding than static ones like Rust. But Dan Luu's own tests on zstd and Pandoc show the advantage vanishes at higher effort levels, and obscure dense languages like J perform poorly. Popularity correlates with better results, suggesting mainstream languages are the safer bet for LLM users.
Perhaps using an obscure (and "weird") language can make sense if you have a very large budget and you can train or fine-tune a model to be effective for your pet language, but if you're a normal user of LLMs, it seems like sticking with a mainstream language is likely a better bet than using an obscure dense language.
- michaelteter
I'm not sure I trust a source that says "just 70 tokens average, nearly half of Clojure (109 tokens)".
There's no reason to add the phrase "nearly half of", and there's especially no reason to add it when it's significantly far away from half.
But on the main topic, I still feel that Go is an excellent choice for LLMs. There is pretty much just one way of doing most things, and the available training data is pretty consistent. This is very different from Python, where training data is polluted (I presume) with tons of code written by non-software engineers and demonstrating many different ways of doing the same thing.
Also a big plus for Go is the tooling. Fast compiles and good linting shortens the iteration cycle time, resulting in less need for me to tell the LLM to correct mistakes.
For some reason, most LLMs I've used default to wanting to write Python. I have to repeatedly teach them to use Go unless there is a very compelling reason to choose otherwise.
I would personally rather see and use Clojure, but I don't feel its ecosystem would provide the same benefits as Go, including obviously the easy single binary distribution.
- tadamcz
We studied this question pretty systematically in the MirrorCode paper [1], comparing Python, C, Rust, Go, OCaml, and Ada across 19 very long-horizon tasks, for Claude Opus 4.7 and GPT-5.5.
> In our results, there was little sign of inter-language differences in solve rates, for any model (Figure 5b). This suggests that AI models have learned generalized programming skills, rather than pattern-matching syntax. This does not mean that implementation language is irrelevant. Conditional on solving a target, we found a small effect on token usage: successful Python solutions tended to use fewer tokens than average, while successful Ada solutions tended to use more (Appendix C). We consider these to be small differences, given that these six programming languages vary widely in how concise they are, and in how much functionality is provided by their standard library (recall that agents cannot download dependencies in MirrorCode, they must solve the task using only the standard library).
In Appendix C, Ada tended to use only about 25% more tokens than the average language. Ada is a language used mainly in safety-critical aerospace and defense systems, which has ~200x less pre-training data available than C or Python.
We're also comparing more recent language models (on just Go vs Ada, for cost reasons), on our leaderboard [2].
- MichaelNolan
Ive been amazed at how well LLMs are at writing Gleam[1] and Lustre[2]. Compared to a mainstream language, there is basically zero gleam code in the training data.
I have no evidence to back this up, but I suspect that languages that are good for humans[3] will be good for LLMs. Compiled, strongly typed, statically typed, immutable, pure functions, pattern matched, memory safe, etc.
[3] Yes I realize that languages features that are "good for humans" is a hotly debated topic. That's just my personal list for what I like in a language.
- Surac
For me c wins here. It is compact, there are all language parts one needs and available and it well fitted to transport knowledge without much syntax hussle
- gr_norm
It's not clear to me how useful of a signal replicating existing pieces of well-known software is for this kind of evaluation, given what we know about how effectively LLMs can retrieve data from their training corpus and style-transfer it across different settings (programming languages here). That would explain their convergence in ability across different languages on the tasks in this post. I'd be far more interested in people's real-world experiences.
- ramon156
i dont see enough love for Ruby. I've been using it since last year and it feels like php's more robust brother
- dang
Related:
Which programming languages are most token-efficient? - https://news.ycombinator.com/item?id=46582728 - Jan 2026 (91 comments)
- eterm
Zstd gets rather easier from dotnet 11, it becomes a near one-limer since it's getting added into System.IO.comoression.
I know this because my agent already knew this the other day when I was evaluating compression, but that's because it has access to search.
That's a key part of what makes agents good coders too, mine is often looking up and downloading the source for how libraries are implemented.
It seems unnatural to air-gap them for evaluation.
I guess they didn't want them just finding an existing library to copy, but it's not very "real-world" to deny the ability to search quickly.
That said, the best language is still just the one you know. No amount of token saving is worth getting a bunch of code back you can't easily understand and review.