TOKENGOLF ES GitHub ↗

LANGUAGE TOKENS BENCHMARK

Token Golf

The same program, written in five languages by the same AI agent.

Workflow engine

median of 6 runs

Expression evaluator

1 run

JSON Patch

1 run

Output tokens per session, fewest first. Hover or tap a language to find it in every column.

Rust uses the most tokens on the workflow engine and the fewest on the expression evaluator. Python wins JSON Patch and comes last on expressions. No language holds its place across all three tasks.

01 Same prompt, same model, very different runs

The workflow engine was run six times per language. Python's cheapest run used 78.4k output tokens and its most expensive used 154.2k. The gap between runs of the same language is bigger than the gap between the top three languages.

95.0k median · 2.3× spread
96.1k median · 2.0× spread
102.1k median · 2.4× spread
120.0k median · 1.4× spread
128.9k median · 1.3× spread
60k90k120k150k180k

Each dot is one run. The amber tick is the median.

Six runs per language aren't enough to say which language is cheapest.

02 What the token count includes

97% of all tokens processed were cached context: the agent re-reading conversation it had already seen. Per session it ranged from 92% to 98%. The longer a session runs, the more it re-reads, so total tokens mostly track how long the agent kept going. That's why the leaderboard counts output tokens.

03 The course

  1. One spec. A fully specified CLI program: JSON in, JSON out, deterministic, with a closed set of error codes.
  2. Five players. Python, JavaScript, Go, Rust and C. Each gets an independent agent session with tools, a shell and room to self-test.
  3. One referee. A language-agnostic conformance suite that only talks to the binary through its CLI. Fail it and your score doesn't count.
  4. The score. Session output tokens: everything the agent wrote, including reasoning, tool calls and rewrites.
Workflow engineDAG execution, $ref, conditions, retries, 40+ ops
Expression evaluatortokenizer, precedence parser, i64 math, exact error positions
JSON PatchRFC 6901 pointers, six ops, atomicity, error taxonomy

Model: DeepSeek-V4.1-Flash-1017, thinking=high, one autonomous session per run. Every run counted here passes its scored suite.

04 The fine print

Passing ≠ correct

Every submission passes the scored fixtures, but a finite suite doesn't prove complete correctness. A review found two grader bugs, which have been fixed and rescored. No pass/fail result changed.

Not a frozen eval

Some specs, fixtures and oracles were corrected after submissions were examined. The Git history records every change, but this wasn't a pre-registered evaluation.

Trust, partially verified

The raw session logs aren't published, so usage totals and compliance with the no-peeking rules can't be audited from the repo. The launcher isn't an OS sandbox.

05 Contribute

Every submission and the full test suite are in the repo, so you can check these numbers without running a model.

Rescore the results

Rebuild every committed submission and rerun the test suite. No API key needed.

git clone https://github.com/GodGMN/language-tokens-benchmark
python3 benchmark/rescore.py

Add a test case

One JSON file per behaviour. It has to follow from the spec and pass against the reference implementation.

benchmark/holdout/<category>/your_case.json
python3 benchmark/runner.py --language oracle

Add a model or a language

A new round for another model, or an adapter for Kotlin, Swift, Zig and so on. Use a new round id and commit failed runs too.

benchmark/rounds/<round>/round.json
benchmark/adapters/<lang>.json

Contributing guide ↗ Methodology ↗ Full conclusions ↗

06 Every sample

All 45 sessions, nothing filtered. Download dataset.csv or dataset.json.

Show all 45 rows
RoundTaskLanguageTestsOutputTotalTurnsCost
round-8-exprexpr v1C56/5671,3781,887,13429$0.103
round-8-exprexpr v1Go56/5660,1301,408,63430$0.086
round-8-exprexpr v1JavaScript56/5660,0221,241,69822$0.084
round-8-exprexpr v1Python56/5673,9832,524,50038$0.112
round-8-exprexpr v1Rust56/5659,4631,067,22423$0.080
round-9-patchpatch v1C38/3877,1862,355,51541$0.112
round-9-patchpatch v1Go38/3842,905709,94121$0.059
round-9-patchpatch v1JavaScript38/3866,7181,562,15029$0.095
round-9-patchpatch v1Python38/3837,514700,54320$0.054
round-9-patchpatch v1Rust38/3844,765925,32728$0.065
round-1workflow v1C106/106121,9985,224,05755$0.191
round-1workflow v1Go106/106113,3063,365,41540$0.162
round-1workflow v1JavaScript106/10690,7362,959,54840$0.134
round-1workflow v1Python106/106125,0316,222,74565$0.200
round-1workflow v1Rust106/106156,0639,405,16185$0.255
round-2workflow v2C112/112118,8856,107,26760$0.192
round-3workflow v2C112/112142,2256,068,70257$0.215
round-4workflow v2C112/112117,3656,633,40666$0.198
round-5workflow v2C112/112121,1156,223,05157$0.205
round-6workflow v2C112/112108,5813,997,43845$0.163
round-7workflow v2C112/112154,77812,365,11094$0.287
round-2workflow v2Go112/112110,4063,455,92937$0.163
round-3workflow v2Go112/11269,8351,891,86434$0.101
round-4workflow v2Go112/112170,1196,404,92358$0.251
round-5workflow v2Go112/112101,8242,538,89532$0.143
round-6workflow v2Go112/112102,3884,517,85460$0.159
round-7workflow v2Go112/11278,5374,149,14161$0.128
round-2workflow v2JavaScript112/112119,3924,913,75653$0.180
round-3workflow v2JavaScript112/11267,7141,351,23623$0.095
round-4workflow v2JavaScript112/112157,6029,721,33280$0.260
round-5workflow v2JavaScript112/11293,4052,785,93839$0.137
round-6workflow v2JavaScript112/11296,6394,513,01055$0.153
round-7workflow v2JavaScript112/11287,8203,007,45741$0.132
round-2workflow v2Python112/11282,1233,323,52349$0.128
round-3workflow v2Python112/112106,1685,585,81164$0.171
round-4workflow v2Python112/11278,3853,121,62545$0.121
round-5workflow v2Python112/112154,25011,614,289103$0.266
round-6workflow v2Python112/11286,0963,667,69046$0.135
round-7workflow v2Python112/112123,8746,737,22569$0.200
round-2workflow v2Rust112/112104,4084,194,69454$0.158
round-3workflow v2Rust112/112112,0314,635,08558$0.172
round-4workflow v2Rust112/112125,8868,193,63285$0.211
round-5workflow v2Rust112/112140,8466,020,67956$0.218
round-6workflow v2Rust112/112135,2798,987,97185$0.230
round-7workflow v2Rust112/112131,8247,532,33787$0.215