The Token Benchmark

How many tokens
does a language cost?

−20%

Across five everyday programs, Faby uses ~20% fewer tokens on average than the mean of Python, TypeScript and Rust — and up to 33% on data-transformation code.

Same programs. One identical tokenizer. Every number below is reproducible — and we show the one task where Faby doesn't win.

5 TASKS4 LANGUAGES1 OPEN TOKENIZERFULLY REPRODUCIBLE
Task by task

Pick a program. Count the tokens.

Each task is implemented idiomatically in all four languages — no strawmen, no golfing. Switch tasks and compare the real code side by side.

FABY

      

      
All results

The full table.

TaskPythonTypeScriptRustFabyvs avg

Tokens per program. “vs avg” = Faby vs the mean of the other three. Negative = fewer tokens.

Methodology

Open, fair, reproducible.

The tokenizer

One identical function counts tokens for every language: each word (identifier, keyword, number) is one token, and every other non-whitespace character (operator, bracket, punctuation) is one token. Applied uniformly, it rewards exactly what Faby optimizes for — fewer symbols per idea.

const tokens = code => (code.match(/\w+|[^\s\w]/g) || []).length

The rules

Programs are written idiomatically in each language — the way a competent developer (or a good model) would actually write them. No artificial verbosity in the others, no code-golf in Faby. Comments excluded. Each task solves the identical problem with identical output.

Reproduce it yourself

Every program on this page is shown in full above. Paste any two into the tokenizer and compare. Faby programs also run live in the playground.

What this is not Token counts are a proxy, not a verdict — they don't measure runtime speed, type safety, or ecosystem. This counts lexical tokens, not a specific model's BPE vocabulary (which varies per model). And note FizzBuzz: Faby's exhaustive match is slightly longer there. We show it anyway — a benchmark you can only trust if it includes the cases you lose.

Fewer tokens. Same idea.

That's the whole point of an AI-native language — and you can run every Faby program here in your browser.

▶ Try it in the Playground Read the Docs