The Best Programming Language for Tokenmaxxing: An Investigation of Coding Agent Behavior Across Programming Languages
This program is tentative and subject to change.
Coding agents now solve programming problems at comparable rates across languages, but reaching a solution is not equally cheap in every language. We study how the choice of programming language affects the tokens an agent spends, and what agent behavior drives the difference. We run four models—Gemma, Qwen, GPT-5.5, and Sonnet—in Python, Java, Rust, and OCaml on MiniLCB, a 100-problem subset of LiveCodeBench, letting each agent iterate against a vis- ible test suite until it passes. After controlling for problem difficulty, OCaml costs significantly more than Python for every model, while the Java and Rust penalties depend on the model.
Why is this the case? To explain where the extra tokens go, we re-execute every intermediate solution an agent writes and abstract each trajectory into a graph over passing and failing test states. We then label the work that drives each transition between states. These trajectory graphs expose the sources of token cost that a raw count hides: agents thrash against an unfamiliar language’s compiler, over-revise solutions that already pass, and reach for a more familiar language to sidestep an unfamiliar one. We propose token efficiency as a second axis for benchmarking multilingual coding agents, complementary to success rate—and, for the tokenmaxxer, a guide to the most expensive language to work in.