Yukihiro “Matz” Matsumoto, the creator of Ruby, is working on Spinel — an ahead-of-time (AOT) compiler that transforms Ruby source code into standalone native executables. He presented it at RubyKaigi 2026 with a live demonstration, and the results are impressive: 11.6x faster than miniruby across benchmarks, with computation-heavy workloads reaching 24–87x speedups.
How it works
Spinel’s compilation pipeline has three stages:
- Parsing — a C binary (
spinel_parse) uses libprism to parse Ruby and serialize the AST. - Code generation — a self-hosted Ruby binary (
spinel_codegen) performs whole-program type inference and generates optimized C. - Compilation — a standard C compiler produces a standalone binary with no runtime dependencies beyond libc and libm.
The self-hosting part is the most interesting detail. The compiler backend is a 21,000-line Ruby file that Spinel itself compiles into a native binary. The compiler compiles itself.
Spinel was originally implemented in C (18K lines, branch c-version), then rewritten in Ruby (branch ruby-v1), and finally rewritten in a self-hosting Ruby subset (current master).
What it supports
Spinel covers a substantial subset of Ruby: classes, inheritance, mixins, pattern matching, exceptions, blocks, lambdas, fiber-based concurrency, and the core data types you’d expect (strings, arrays, hashes, ranges, regexes, bigints with auto-promotion).
What it deliberately excludes tells you a lot about the design philosophy: no eval, no send, no method_missing, no define_method, no threads. These are the features that make Ruby almost impossible to compile efficiently — every call site becomes a potential dispatch to anywhere. By drawing a clear line, Spinel can perform aggressive optimizations that a general Ruby implementation cannot.
Built with AI in ~1 month
According to Hacker News discussion, Matz developed Spinel with AI assistance in approximately one month. One commenter put it well: “AI will turn 10x programmers into 100x programmers. Or in Matz’s case maybe 100x programmers into 500x programmers.” The 21,000-line codegen file is a product of that collaboration — ambitious in scope, generated at a pace that would be unusual without AI tooling.
Where it fits
Spinel is not a replacement for CRuby. It’s closer to what PreScheme was to Scheme — a compilable subset designed for specific use cases. If your Ruby code avoids heavy metaprogramming, Spinel could turn it into a fast, dependency-free binary. Think CLI tools, data processing scripts, and compute-intensive tasks where startup time and throughput matter.