Skip to content

Why Ruby

Average tokens per Rosetta Code task by language: Ruby is third at about 116, next to Clojure and Julia at 109, and well ahead of JavaScript at 181, Java at 187 and C at 285

Chart redrawn from the data in Martin Alderson’s Which programming languages are most token-efficient? (values read off the published chart). The study counted tokens for the same Rosetta Code tasks in each language using a GPT-4 tokenizer. Its author calls it an illustrative comparison, not a rigorous study. TypeScript was left out for lack of tasks.

  • Fewer tokens. Ruby is one of the most token-efficient mainstream languages. In the chart above it needs about a third fewer tokens than JavaScript for the same task. A harness built for small context windows benefits twice: models read and write less code, and contributors’ agents spend less context on the harness itself.
  • Contributing with local models. Fewer tokens and zero dependencies mean a local model on modest hardware can read, change and test this codebase. Contributing doesn’t require a large hosted model.
  • Easy to read. Human contributors can catch up quickly without much effort. TypeScript and its types would have been the stronger choice for people alone. This is an agent-first harness, though, so it is written in a language that is friendlier to agents and still easy for people.
  • Easy to review. Ruby is easy to skim when you approve a pull request, read code or leave review comments. That matters for a project that expects many outside contributions.
  • A bit of history. Ruby and Ruby on Rails are what first pulled the author towards AdonisJS and deeper TypeScript work. There was never time to learn Ruby properly back then, but its influence stuck. This project is the chance to build in it.

Built by V and Bruno LLC: Astro sites & AI tooling. Work with us →